diff --git a/src/main/java/emu/lunarcore/data/config/SkillAbilityInfo.java b/src/main/java/emu/lunarcore/data/config/SkillAbilityInfo.java index d6896452c..2d06d7d87 100644 --- a/src/main/java/emu/lunarcore/data/config/SkillAbilityInfo.java +++ b/src/main/java/emu/lunarcore/data/config/SkillAbilityInfo.java @@ -69,6 +69,8 @@ private void parseTask(MazeSkill skill, List actionList, TaskIn 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) { diff --git a/src/main/java/emu/lunarcore/data/config/TaskInfo.java b/src/main/java/emu/lunarcore/data/config/TaskInfo.java index 86c6d96d0..3587b11eb 100644 --- a/src/main/java/emu/lunarcore/data/config/TaskInfo.java +++ b/src/main/java/emu/lunarcore/data/config/TaskInfo.java @@ -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; diff --git a/src/main/java/emu/lunarcore/game/battle/Battle.java b/src/main/java/emu/lunarcore/game/battle/Battle.java index ec1134ebc..981cf849b 100644 --- a/src/main/java/emu/lunarcore/game/battle/Battle.java +++ b/src/main/java/emu/lunarcore/game/battle/Battle.java @@ -20,10 +20,7 @@ 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 npcMonsters; - private final List buffs; private final List waves; private final List drops; + private final Int2ObjectMap buffs; private final long timestamp; private BattleStage stage; // Main battle stage @@ -60,7 +57,7 @@ private Battle(Player player, PlayerLineup lineup) { 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 MazeBuff addBuff(int buffId, int ownerIndex, int waveFlag) { } 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 SceneBattleInfo toProto() { } // Buffs - for (MazeBuff buff : this.getBuffs()) { - proto.addBuffList(buff.toProto()); + for (var entry : this.getBuffs().int2ObjectEntrySet()) { + proto.addBuffList(entry.getValue().toProto()); } // Client turn snapshots diff --git a/src/main/java/emu/lunarcore/game/battle/BattleService.java b/src/main/java/emu/lunarcore/game/battle/BattleService.java index 849a8fcf5..b1caf9c0b 100644 --- a/src/main/java/emu/lunarcore/game/battle/BattleService.java +++ b/src/main/java/emu/lunarcore/game/battle/BattleService.java @@ -138,11 +138,22 @@ public void startBattle(Player player, int casterId, int attackedGroupId, MazeSk // 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) diff --git a/src/main/java/emu/lunarcore/game/battle/skills/MazeSkill.java b/src/main/java/emu/lunarcore/game/battle/skills/MazeSkill.java index 60df6f5b7..a1ce74074 100644 --- a/src/main/java/emu/lunarcore/game/battle/skills/MazeSkill.java +++ b/src/main/java/emu/lunarcore/game/battle/skills/MazeSkill.java @@ -2,11 +2,13 @@ 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 castActions; private List attackActions; + private Set adventureModifiers; @Setter private boolean triggerBattle; @@ -27,6 +30,20 @@ public MazeSkill(AvatarExcel excel, int index) { 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 */