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