Commit 6ec372e6 authored by KingRainbow44's avatar KingRainbow44
Browse files

Add invoke-level invulnerability for bursts.

parent 7df41f61
......@@ -6,7 +6,6 @@ import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.props.FightProperty;
import emu.grasscutter.net.packet.Opcodes;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.AttackResultOuterClass;
import emu.grasscutter.net.proto.AttackResultOuterClass.AttackResult;
import emu.grasscutter.net.proto.CombatInvocationsNotifyOuterClass.CombatInvocationsNotify;
import emu.grasscutter.net.proto.CombatInvokeEntryOuterClass.CombatInvokeEntry;
......@@ -18,7 +17,6 @@ import emu.grasscutter.net.proto.MotionInfoOuterClass.MotionInfo;
import emu.grasscutter.net.proto.MotionStateOuterClass.MotionState;
import emu.grasscutter.net.proto.PlayerDieTypeOuterClass;
import emu.grasscutter.server.event.entity.EntityMoveEvent;
import emu.grasscutter.server.event.game.ReceiveCommandFeedbackEvent;
import emu.grasscutter.server.game.GameSession;
import emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify;
import emu.grasscutter.utils.Position;
......@@ -36,16 +34,22 @@ public class HandlerCombatInvocationsNotify extends PacketHandler {
for (CombatInvokeEntry entry : notif.getInvokeListList()) {
// Handle combat invoke
switch (entry.getArgumentType()) {
case COMBAT_TYPE_ARGUMENT_EVT_BEING_HIT:
case COMBAT_TYPE_ARGUMENT_EVT_BEING_HIT -> {
EvtBeingHitInfo hitInfo = EvtBeingHitInfo.parseFrom(entry.getCombatData());
AttackResult attackResult = hitInfo.getAttackResult();
Player player = session.getPlayer();
// Check if the player is invulnerable.
if (
attackResult.getAttackerId() != player.getTeamManager().getCurrentAvatarEntity().getId() &&
player.getAbilityManager().isAbilityInvulnerable()
) break;
// Handle damage
player.getAttackResults().add(attackResult);
player.getEnergyManager().handleAttackHit(hitInfo);
break;
case COMBAT_TYPE_ARGUMENT_ENTITY_MOVE:
}
case COMBAT_TYPE_ARGUMENT_ENTITY_MOVE -> {
// Handle movement
EntityMoveInfo moveInfo = EntityMoveInfo.parseFrom(entry.getCombatData());
GameEntity entity = session.getPlayer().getScene().getEntityById(moveInfo.getEntityId());
......@@ -90,17 +94,16 @@ public class HandlerCombatInvocationsNotify extends PacketHandler {
continue;
}
}
break;
case COMBAT_TYPE_ARGUMENT_ANIMATOR_PARAMETER_CHANGED:
}
case COMBAT_TYPE_ARGUMENT_ANIMATOR_PARAMETER_CHANGED -> {
EvtAnimatorParameterInfo paramInfo = EvtAnimatorParameterInfo.parseFrom(entry.getCombatData());
if (paramInfo.getIsServerCache()) {
paramInfo = paramInfo.toBuilder().setIsServerCache(false).build();
entry = entry.toBuilder().setCombatData(paramInfo.toByteString()).build();
}
break;
default:
break;
}
default -> {
}
}
session.getPlayer().getCombatInvokeHandler().addEntry(entry.getForwardType(), entry);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment