Skip to content

Commit

Permalink
Update status effect display methods and improve level regeneration l…
Browse files Browse the repository at this point in the history
…ogic
  • Loading branch information
Mikhael-Danilov committed Dec 23, 2024
1 parent 141dcea commit 896090a
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 17 deletions.
2 changes: 1 addition & 1 deletion RemixedDungeon/src/main/assets/scripts/buffs/Counter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ return buff.init{
RPD.debug("counter: %d", self.data.counter)
storage.gamePut("CounterBuffTest", self.data.counter)
storage.put("CounterBuffTest", self.data.counter)
buff.target:getSprite():showStatus( 0xFF00FF, tostring(self.data.counter))
buff.target:showStatus( 0xFF00FF, tostring(self.data.counter))
end
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ return item.init{
end,

defenceProc = function(self, item, attacker, defender, damage)
defender:getSprite():showStatus(0x00b77070,"ouch!")
defender:showStatus(0x00b77070,"ouch!")
return damage
end,
}
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ return itemLib.init{
self.data.counter = (self.data.counter or 0) + 1

if item:getOwner():valid() then
item:getOwner():getSprite():showStatus( 0xFF00FF, tostring(self.data.counter))
item:getOwner():showStatus( 0xFF00FF, tostring(self.data.counter))
end

item:spend(1)
Expand Down
2 changes: 1 addition & 1 deletion RemixedDungeon/src/main/assets/scripts/npc/BlackCat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ return mob.init({
local hero = RPD.Dungeon.hero
hero:STR(math.max(hero:STR()-1,1))
hero:getSprite():emitter():burst( RPD.Sfx.ShadowParticle.CURSE, 6 )
hero:getSprite():showStatus( 0xFF0000, RPD.textById("Str_lose"))
hero:showStatus( 0xFF0000, RPD.textById("Str_lose"))
RPD.playSound( "snd_cursed" )
end,

Expand Down
2 changes: 1 addition & 1 deletion RemixedDungeon/src/main/assets/scripts/spells/Backstab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ return spell.init{
return false
end

victim:getSprite():showStatus(0xff2030,"backstab")
victim:showStatus(0xff2030,"backstab")

local weapon = caster:getBelongings().weapon
local secondaryWeapon = caster:getBelongings().leftHand
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,7 @@ public void showStatus(int color, String text) {
getSprite().showStatus(color, text);
}

@LuaInterface
public void showStatus(int color, String text, Object... args) {
public void showStatus_a(int color, String text, Object... args) {
getSprite().showStatus(color, text, args);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ public void earnExp(int exp) {

this.setExp(this.getExpForLevelUp() + exp);

showStatus(CharSprite.POSITIVE, TXT_EXP, exp);
showStatus_a(CharSprite.POSITIVE, TXT_EXP, exp);

boolean levelUp = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void doDrink(@NotNull Char chr) {
int effect = Math.min(chr.ht() - chr.hp(), value);
if (effect > 0) {
chr.heal(effect, this);
chr.showStatus(CharSprite.POSITIVE, TXT_VALUE, effect);
chr.showStatus_a(CharSprite.POSITIVE, TXT_VALUE, effect);
}

setVolume(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public boolean doPickUp(@NotNull Char hero ) {
int effect = Math.min( hero.ht() - hero.hp(), value[0] * quantity() );
if (effect > 0) {
hero.heal(effect, this);
hero.showStatus( CharSprite.POSITIVE, TXT_VALUE, effect );
hero.showStatus_a( CharSprite.POSITIVE, TXT_VALUE, effect );
collected = true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public boolean doPickUp(@NotNull Char hero) {
Badges.validateGoldCollected();

GameScene.pickUp(this);
hero.showStatus(CharSprite.NEUTRAL, TXT_VALUE, quantity());
hero.showStatus_a(CharSprite.NEUTRAL, TXT_VALUE, quantity());
hero.spend(TIME_TO_PICK_UP);

Sample.INSTANCE.play(Assets.SND_GOLD, 1, 1, Random.Float(0.9f, 1.1f));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public int defenceProc(Armor armor, Char attacker, Char defender, int damage ) {
}
debuff.prolong( damage );

defender.showStatus( CharSprite.WARNING, StringsManager.getVar(R.string.Viscosity_Status), damage );
defender.showStatus_a( CharSprite.WARNING, StringsManager.getVar(R.string.Viscosity_Status), damage );

return 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,14 +387,28 @@ public void createGameScene(@NotNull Level level, @NotNull Hero hero) {

Camera.main.setTarget(hero.getHeroSprite());

int l_w = level.getWidth();
int l_h = level.getHeight();

level.activateScripts();

// Epic level gen compatibility
createTerrain(level);
boolean epicRegen = false;
if(l_w != level.getWidth() || l_h != level.getHeight()) {
epicRegen = true;
}

if(epicRegen) {
// Epic level gen compatibility
createTerrain(level);
}

LevelTools.upgradeMap(level);
// Yeah, epic level gen compatibility
Dungeon.initSizeDependentStuff(level.getWidth(), level.getHeight());
fog.reinit(level.getWidth(), level.getHeight());

if(epicRegen) {
// Yeah, epic level gen compatibility
Dungeon.initSizeDependentStuff(level.getWidth(), level.getHeight());
fog.reinit(level.getWidth(), level.getHeight());
}

level.addVisuals(this);

Expand Down

0 comments on commit 896090a

Please sign in to comment.