mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-25 13:01:03 +00:00
Add invoke-level invulnerability for bursts.
This commit is contained in:
parent
7df41f616b
commit
6ec372e64f
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user