mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-18 09:54:59 +01:00
Extend spawn command (#1777)
* add missing EntityTypes * small command refactorings and improvements * move common command patterns and methods to CommandHelpers * let the spawn command detect the entityType instead of spawning every entity as EntityVehicle * add extra options for spawning gadgets for better debuging and testing * More spawn command additions and cleanups+EntityVehicle changes * Moved remaining patterns from GiveCommand and ClearCommand to CommandHelpers * Added patterns for hp, maxhp, atk, def and (monster)ai for the spawn command * Moved intParam parsing via regex to the CommandHelpers * Read most of EntityVehicle stats from the ConfigGadget instead of hardcoding them Co-authored-by: hartie95 <mail@hartie95.de>
This commit is contained in:
committed by
GitHub
parent
9671a76af2
commit
08f361954a
@@ -60,7 +60,7 @@ public class EntityGadget extends EntityBaseGadget {
|
||||
this.gadgetId = gadgetId;
|
||||
this.pos = pos.clone();
|
||||
this.rot = rot != null ? rot.clone() : new Position();
|
||||
fillFightProps();
|
||||
fillFightProps(configGadget);
|
||||
}
|
||||
|
||||
public EntityGadget(Scene scene, int gadgetId, Position pos) {
|
||||
@@ -72,22 +72,6 @@ public class EntityGadget extends EntityBaseGadget {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
private void fillFightProps() {
|
||||
if (configGadget == null || configGadget.getCombat() == null) {
|
||||
return;
|
||||
}
|
||||
var combatData = configGadget.getCombat();
|
||||
var combatProperties = combatData.getProperty();
|
||||
|
||||
var targetHp = combatProperties.getHP();
|
||||
setFightProperty(FightProperty.FIGHT_PROP_MAX_HP, targetHp);
|
||||
if (combatProperties.isInvincible()) {
|
||||
targetHp = Float.POSITIVE_INFINITY;
|
||||
}
|
||||
setFightProperty(FightProperty.FIGHT_PROP_CUR_HP, targetHp);
|
||||
setLockHP(combatProperties.isLockHP());
|
||||
}
|
||||
|
||||
public GadgetData getGadgetData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user