mirror of
https://github.com/Melledy/LunarCore.git
synced 2025-12-12 13:24:36 +01:00
Fix some techniques not applying debuffs to monsters in battle
This commit is contained in:
@@ -128,7 +128,10 @@ public class Battle {
|
|||||||
var wave = new BattleMonsterWave(stage);
|
var wave = new BattleMonsterWave(stage);
|
||||||
wave.getMonsters().addAll(stageMonsterWave);
|
wave.getMonsters().addAll(stageMonsterWave);
|
||||||
|
|
||||||
// Handle npc monster
|
// Add wave to battle
|
||||||
|
this.getWaves().add(wave);
|
||||||
|
|
||||||
|
// Add buffs from npc monsters
|
||||||
if (npcMonster != null) {
|
if (npcMonster != null) {
|
||||||
// Set wave custom level
|
// Set wave custom level
|
||||||
wave.setCustomLevel(npcMonster.getCustomLevel());
|
wave.setCustomLevel(npcMonster.getCustomLevel());
|
||||||
@@ -136,9 +139,6 @@ public class Battle {
|
|||||||
// Handle monster buffs
|
// Handle monster buffs
|
||||||
npcMonster.applyBuffs(this, this.getWaves().size());
|
npcMonster.applyBuffs(this, this.getWaves().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finally add wave to battle
|
|
||||||
this.getWaves().add(wave);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,8 +247,8 @@ public class Battle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Buffs
|
// Buffs
|
||||||
for (var entry : this.getBuffs().int2ObjectEntrySet()) {
|
for (var buff : this.getBuffs().values()) {
|
||||||
proto.addBuffList(entry.getValue().toProto());
|
proto.addBuffList(buff.toProto());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Client turn snapshots
|
// Client turn snapshots
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ public class EntityMonster implements GameEntity, Tickable {
|
|||||||
this.tempBuffs.add(tempBuff);
|
this.tempBuffs.add(tempBuff);
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void applyBuffs(Battle battle, int waveIndex) {
|
public synchronized void applyBuffs(Battle battle, int waveNum) {
|
||||||
if (this.buffs != null) {
|
if (this.buffs != null) {
|
||||||
for (var entry : this.buffs.int2ObjectEntrySet()) {
|
for (var entry : this.buffs.int2ObjectEntrySet()) {
|
||||||
// Check expiry for buff
|
// Check expiry for buff
|
||||||
@@ -108,26 +108,26 @@ public class EntityMonster implements GameEntity, Tickable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add buff to battle
|
// Add buff to battle
|
||||||
this.applyBuff(battle, entry.getValue(), waveIndex);
|
this.applyBuff(battle, entry.getValue(), waveNum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.getTempBuffs() != null) {
|
if (this.getTempBuffs() != null) {
|
||||||
for (var tempBuff : this.getTempBuffs()) {
|
for (var tempBuff : this.getTempBuffs()) {
|
||||||
this.applyBuff(battle, tempBuff, waveIndex);
|
this.applyBuff(battle, tempBuff, waveNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.tempBuffs = null;
|
this.tempBuffs = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean applyBuff(Battle battle, SceneBuff buff, int waveIndex) {
|
private boolean applyBuff(Battle battle, SceneBuff buff, int waveNum) {
|
||||||
// Get index of owner in lineup
|
// Get index of owner in lineup
|
||||||
int ownerIndex = battle.getLineup().indexOf(buff.getCasterAvatarId());
|
int ownerIndex = battle.getLineup().indexOf(buff.getCasterAvatarId());
|
||||||
|
|
||||||
// Add buff to battle if owner exists
|
// Add buff to battle if owner exists
|
||||||
if (ownerIndex != -1) {
|
if (ownerIndex != -1) {
|
||||||
battle.addBuff(buff.getBuffId(), ownerIndex, 1 << waveIndex);
|
battle.addBuff(buff.getBuffId(), ownerIndex, (1 << waveNum) - 1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user