Skip to content

Commit

Permalink
Items on timeline
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikhael-Danilov committed Sep 27, 2024
1 parent 1f0c6cc commit 142c0ba
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 5 deletions.
4 changes: 2 additions & 2 deletions RemixedDungeon/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ android {
manifestPlaceholders = ["admob_app_id":getApiField("admob_app_id")]

applicationId "com.nyrds.pixeldungeon.ml"
versionCode 1217
versionName "32.1.beta.10"
versionCode 1218
versionName "32.1.beta.1"
targetSdkVersion 34
compileSdkVersion 34
minSdkVersion 21
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ public void postpone(float time) {
this.time = now + time;
}

protected float cooldown() {
@LuaInterface
public float cooldown() {
return time - now;
}

Expand Down Expand Up @@ -409,6 +410,9 @@ private static void add(Actor actor, float time) {

chars.put(ch.getPos(), ch);
all.addAll(ch.buffs());
for (var item : ch.getBelongings()) {
all.add(item);
}
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ public Char getOwner() {
return owner;
}

private class ItemIterator implements Iterator<Item> {
public class ItemIterator implements Iterator<Item> {

private int index = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ public final Item detachAll(@NotNull Bag container) {

protected void onDetach() {
setOwner(CharsList.DUMMY);
Actor.remove(this);
}

public Item upgrade() {
Expand Down Expand Up @@ -495,13 +496,14 @@ protected boolean act() {

@Override
public void storeInBundle(Bundle bundle) {
super.storeInBundle(bundle);
bundle.put(QUANTITY, quantity());
bundle.put(LEVEL, level());
}

@Override
public void restoreFromBundle(Bundle bundle) {

super.restoreFromBundle(bundle);
getId();

quantity(bundle.getInt(QUANTITY));
Expand All @@ -513,6 +515,7 @@ public void restoreFromBundle(Bundle bundle) {
degrade(-level);
}

setOwner(getOwner());
//We still need this because upgrade erase cursed flag
setCursed(bundle.optBoolean("cursed", false));

Expand Down Expand Up @@ -781,6 +784,7 @@ public void ownerDoesDamage(int damage) {
}

public void setOwner(Char owner) {
GLog.debug("%s owner %s", getEntityKind(), owner.getEntityKind());
Actor.add(this);
this.owner = owner;
if (owner.valid()) {
Expand Down Expand Up @@ -822,5 +826,6 @@ public void removeItem() {

owner.getBelongings().removeItem(this);
}
Actor.remove(this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -210,4 +210,12 @@ public void remove() {
public String getEntityKind() {
return getClass().getSimpleName();
}

@Override
public void setOwner(Char owner) {
super.setOwner(owner);
for(Item i:items) {
i.setOwner(owner);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.nyrds.pixeldungeon.windows.VHBox;
import com.nyrds.platform.util.StringsManager;
import com.nyrds.util.GuiProperties;
import com.nyrds.util.Util;
import com.watabou.noosa.Text;
import com.watabou.pixeldungeon.actors.Char;
import com.watabou.pixeldungeon.items.Item;
Expand Down Expand Up @@ -44,6 +45,9 @@ public WndItem(final WndBag bag, final Item item) {
}

Text info = PixelScene.createMultiline(item.info(), GuiProperties.regularFontSize());
if(Util.isDebug()) {
info.text(info.text()+Utils.format("\ncooldown %.1f\nowner %s",item.cooldown(),item.getOwner().getEntityKind()));
}
info.maxWidth(WIDTH);
info.setX(titlebar.left());
info.setY(titlebar.bottom() + GAP);
Expand Down

0 comments on commit 142c0ba

Please sign in to comment.