mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2024-11-23 04:19:43 +00:00
Format code [skip actions]
This commit is contained in:
parent
d8c3da8fcd
commit
cdb0dc560a
@ -332,7 +332,6 @@ public class AbilityModifier implements Serializable {
|
||||
public int monsterID;
|
||||
public int summonTag;
|
||||
|
||||
|
||||
public AbilityModifierAction[] actions;
|
||||
public AbilityModifierAction[] successActions;
|
||||
public AbilityModifierAction[] failActions;
|
||||
|
@ -1,8 +1,7 @@
|
||||
package emu.grasscutter.data.binout.config.fields;
|
||||
|
||||
import lombok.*;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
import java.util.List;
|
||||
import lombok.*;
|
||||
|
||||
@Data
|
||||
public class ConfigCombatSummon {
|
||||
|
@ -8,8 +8,8 @@ import emu.grasscutter.data.binout.AbilityModifier.AbilityModifierAction;
|
||||
import emu.grasscutter.game.ability.Ability;
|
||||
import emu.grasscutter.game.entity.*;
|
||||
import emu.grasscutter.game.world.*;
|
||||
import emu.grasscutter.server.packet.send.PacketMonsterSummonTagNotify;
|
||||
import emu.grasscutter.net.proto.EPKDEHOJFLIOuterClass.EPKDEHOJFLI;
|
||||
import emu.grasscutter.server.packet.send.PacketMonsterSummonTagNotify;
|
||||
import emu.grasscutter.utils.*;
|
||||
|
||||
@AbilityAction(AbilityModifierAction.Type.Summon)
|
||||
@ -26,7 +26,8 @@ public class ActionSummon extends AbilityActionHandler {
|
||||
// 13: Vector rot
|
||||
summonPosRot = EPKDEHOJFLI.parseFrom(abilityData);
|
||||
} catch (InvalidProtocolBufferException e) {
|
||||
Grasscutter.getLogger().error("Failed to parse abilityData: {}", Utils.bytesToHex(abilityData.toByteArray()));
|
||||
Grasscutter.getLogger()
|
||||
.error("Failed to parse abilityData: {}", Utils.bytesToHex(abilityData.toByteArray()));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -51,8 +52,15 @@ public class ActionSummon extends AbilityActionHandler {
|
||||
scene.addEntity(entity);
|
||||
scene.getPlayers().get(0).sendPacket(new PacketMonsterSummonTagNotify(ownerEntity));
|
||||
|
||||
Grasscutter.getLogger().trace("Spawned entityId {} monsterId {} pos {} rot {}, target { {} }, action { {} }",
|
||||
entity.getId(), monsterId, pos, rot, target, action);
|
||||
Grasscutter.getLogger()
|
||||
.trace(
|
||||
"Spawned entityId {} monsterId {} pos {} rot {}, target { {} }, action { {} }",
|
||||
entity.getId(),
|
||||
monsterId,
|
||||
pos,
|
||||
rot,
|
||||
target,
|
||||
action);
|
||||
|
||||
return true;
|
||||
} else {
|
||||
|
@ -83,12 +83,15 @@ public class EntityMonster extends GameEntity {
|
||||
this.configEntityMonster = null;
|
||||
}
|
||||
|
||||
if (this.configEntityMonster != null &&
|
||||
this.configEntityMonster.getCombat() != null &&
|
||||
this.configEntityMonster.getCombat().getSummon() != null &&
|
||||
this.configEntityMonster.getCombat().getSummon().getSummonTags() != null) {
|
||||
this.configEntityMonster.getCombat().getSummon().getSummonTags().forEach(
|
||||
t -> this.summonTagMap.put(t.getSummonTag(), null));
|
||||
if (this.configEntityMonster != null
|
||||
&& this.configEntityMonster.getCombat() != null
|
||||
&& this.configEntityMonster.getCombat().getSummon() != null
|
||||
&& this.configEntityMonster.getCombat().getSummon().getSummonTags() != null) {
|
||||
this.configEntityMonster
|
||||
.getCombat()
|
||||
.getSummon()
|
||||
.getSummonTags()
|
||||
.forEach(t -> this.summonTagMap.put(t.getSummonTag(), null));
|
||||
}
|
||||
|
||||
// Monster weapon
|
||||
@ -408,13 +411,9 @@ public class EntityMonster extends GameEntity {
|
||||
var data = this.getMonsterData();
|
||||
|
||||
var aiInfo =
|
||||
SceneEntityAiInfo.newBuilder()
|
||||
.setIsAiOpen(true)
|
||||
.setBornPos(this.getBornPos().toProto());
|
||||
SceneEntityAiInfo.newBuilder().setIsAiOpen(true).setBornPos(this.getBornPos().toProto());
|
||||
if (ownerEntityId != 0) {
|
||||
aiInfo.setServantInfo(
|
||||
ServantInfo.newBuilder()
|
||||
.setMasterEntityId(ownerEntityId));
|
||||
aiInfo.setServantInfo(ServantInfo.newBuilder().setMasterEntityId(ownerEntityId));
|
||||
}
|
||||
|
||||
var authority =
|
||||
|
@ -1,6 +1,5 @@
|
||||
package emu.grasscutter.game.entity;
|
||||
|
||||
import emu.grasscutter.Grasscutter;
|
||||
import emu.grasscutter.data.GameData;
|
||||
import emu.grasscutter.data.binout.*;
|
||||
import emu.grasscutter.game.ability.*;
|
||||
@ -122,8 +121,9 @@ public abstract class GameEntity {
|
||||
public void onAddAbilityModifier(AbilityModifier data) {
|
||||
// Set limbo state (invulnerability at a certain HP threshold)
|
||||
// if ability modifier calls for it
|
||||
if (data.state == AbilityModifier.State.Limbo &&
|
||||
data.properties != null && data.properties.Actor_HpThresholdRatio > .0f) {
|
||||
if (data.state == AbilityModifier.State.Limbo
|
||||
&& data.properties != null
|
||||
&& data.properties.Actor_HpThresholdRatio > .0f) {
|
||||
this.setLimbo(data.properties.Actor_HpThresholdRatio);
|
||||
}
|
||||
}
|
||||
@ -198,8 +198,8 @@ public abstract class GameEntity {
|
||||
// Don't let entity die while in limbo.
|
||||
effectiveDamage = curHp - 1;
|
||||
}
|
||||
}
|
||||
else if (curHp != Float.POSITIVE_INFINITY && !lockHP || lockHP && curHp <= event.getDamage()) {
|
||||
} else if (curHp != Float.POSITIVE_INFINITY && !lockHP
|
||||
|| lockHP && curHp <= event.getDamage()) {
|
||||
effectiveDamage = event.getDamage();
|
||||
}
|
||||
|
||||
|
@ -1,21 +1,16 @@
|
||||
package emu.grasscutter.server.packet.send;
|
||||
|
||||
import emu.grasscutter.game.entity.EntityMonster;
|
||||
import emu.grasscutter.game.player.Player;
|
||||
import emu.grasscutter.game.world.Scene;
|
||||
import emu.grasscutter.net.packet.*;
|
||||
import emu.grasscutter.net.proto.MonsterSummonTagNotifyOuterClass.MonsterSummonTagNotify;
|
||||
import java.util.*;
|
||||
import static java.util.Map.entry;
|
||||
|
||||
public class PacketMonsterSummonTagNotify extends BasePacket {
|
||||
|
||||
public PacketMonsterSummonTagNotify(EntityMonster monsterEntity) {
|
||||
super(PacketOpcodes.MonsterSummonTagNotify);
|
||||
|
||||
var proto =
|
||||
MonsterSummonTagNotify.newBuilder()
|
||||
.setMonsterEntityId(monsterEntity.getId());
|
||||
var proto = MonsterSummonTagNotify.newBuilder().setMonsterEntityId(monsterEntity.getId());
|
||||
monsterEntity.getSummonTagMap().forEach((k, v) -> proto.putSummonTagMap(k, v == null ? 0 : 1));
|
||||
|
||||
this.setData(proto.build());
|
||||
|
Loading…
Reference in New Issue
Block a user