Fix techniques that reduce enemy toughness

This commit is contained in:
Melledy
2024-06-22 03:25:31 -07:00
parent 39644fe7e8
commit 7199895441
5 changed files with 43 additions and 15 deletions

View File

@@ -69,6 +69,8 @@ public class SkillAbilityInfo {
actionList.add(new MazeSkillModifySP(50));
} else if (task.getType().contains("CreateSummonUnit")) {
skill.setTriggerBattle(false);
} else if (task.getType().contains("AddAdventureModifier")) {
skill.addAdventureModifier(task.getModifierName());
} else if (task.getType().contains("AdventureSetAttackTargetMonsterDie")) {
actionList.add(new MazeSkillSetAttackTargetMonsterDie());
} else if (task.getSuccessTaskList() != null) {

View File

@@ -18,6 +18,7 @@ public class TaskInfo {
@SerializedName(value = "ID", alternate = {"SummonUnitID"})
private int ID;
private String ModifierName;
private boolean TriggerBattle = true;
private DynamicFloat LifeTime;

View File

@@ -20,10 +20,7 @@ import emu.lunarcore.proto.BattleTargetOuterClass.BattleTarget;
import emu.lunarcore.proto.SceneBattleInfoOuterClass.SceneBattleInfo;
import emu.lunarcore.proto.SceneBattleInfoOuterClass.SceneBattleInfo.BattleTargetInfoEntry;
import emu.lunarcore.util.Utils;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.ints.IntArrayList;
import it.unimi.dsi.fastutil.ints.IntList;
import it.unimi.dsi.fastutil.ints.*;
import lombok.Getter;
import lombok.Setter;
@@ -33,9 +30,9 @@ public class Battle {
private final Player player;
private final PlayerLineup lineup;
private final List<EntityMonster> npcMonsters;
private final List<MazeBuff> buffs;
private final List<BattleMonsterWave> waves;
private final List<GameItem> drops;
private final Int2ObjectMap<MazeBuff> buffs;
private final long timestamp;
private BattleStage stage; // Main battle stage
@@ -60,7 +57,7 @@ public class Battle {
this.player = player;
this.lineup = lineup;
this.npcMonsters = new ArrayList<>();
this.buffs = new ArrayList<>();
this.buffs = new Int2ObjectLinkedOpenHashMap<>();
this.waves = new ArrayList<>();
this.drops = new ArrayList<>();
this.timestamp = System.currentTimeMillis();
@@ -190,12 +187,12 @@ public class Battle {
}
public MazeBuff addBuff(MazeBuff buff) {
this.buffs.add(buff);
this.buffs.put(buff.getId(), buff);
return buff;
}
public boolean hasBuff(int buffId) {
return this.buffs.stream().filter(buff -> buff.getId() == buffId).findFirst().isPresent();
return this.buffs.containsKey(buffId);
}
public void clearBuffs() {
@@ -250,8 +247,8 @@ public class Battle {
}
// Buffs
for (MazeBuff buff : this.getBuffs()) {
proto.addBuffList(buff.toProto());
for (var entry : this.getBuffs().int2ObjectEntrySet()) {
proto.addBuffList(entry.getValue().toProto());
}
// Client turn snapshots

View File

@@ -138,11 +138,22 @@ public class BattleService extends BaseGameService {
// Add buffs to battle
if (castingAvatar != null) {
// Add elemental weakness debuff to enemies
MazeBuff buff = battle.addBuff(castingAvatar.getExcel().getDamageType().getEnterBattleBuff(), battle.getLineup().getLeader());
if (buff != null && castedSkill != null) {
buff.addTargetIndex(battle.getLineup().getLeader());
buff.addDynamicValue("SkillIndex", castedSkill.getIndex());
// The player is the one attacking
if (castedSkill != null) {
// Get elemental weakness debuff id
int buffId = castingAvatar.getExcel().getDamageType().getEnterBattleBuff();
// Replace with a special debuff that ignores all toughness
if (castedSkill.hasAdventureModifier("ADV_StageAbility_Maze_IgnoreWeakness_MazeSkillMark")) {
buffId = 1000119;
}
// Add buff to battle
MazeBuff buff = battle.addBuff(buffId, battle.getLineup().getLeader());
if (buff != null) {
buff.addTargetIndex(battle.getLineup().getLeader());
buff.addDynamicValue("SkillIndex", castedSkill.getIndex());
}
}
} else {
// Ambush debuff (from monsters)

View File

@@ -2,11 +2,13 @@ package emu.lunarcore.game.battle.skills;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import emu.lunarcore.data.excel.AvatarExcel;
import emu.lunarcore.game.avatar.GameAvatar;
import emu.lunarcore.game.scene.entity.GameEntity;
import emu.lunarcore.proto.MotionInfoOuterClass.MotionInfo;
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
import lombok.Getter;
import lombok.Setter;
@@ -16,6 +18,7 @@ public class MazeSkill {
private int index;
private List<MazeSkillAction> castActions;
private List<MazeSkillAction> attackActions;
private Set<String> adventureModifiers;
@Setter private boolean triggerBattle;
@@ -27,6 +30,20 @@ public class MazeSkill {
this.attackActions = new ArrayList<>();
}
public void addAdventureModifier(String modifier) {
if (modifier == null) return;
if (this.adventureModifiers == null) {
this.adventureModifiers = new ObjectOpenHashSet<>();
}
this.adventureModifiers.add(modifier);
}
public boolean hasAdventureModifier(String modifier) {
return adventureModifiers.contains(modifier);
}
/**
* Triggered when player casts a skill
*/