53public final class CombatProjectile {
55 public static final Map<String, CombatProjectile> definitions =
new HashMap<>();
57 private final String name;
58 private final int maxHit;
65 private final int hitDelay;
66 private final int hitsplatDelay;
72 this.animation = animation;
75 this.projectile = projectile;
76 this.hitDelay = hitDelay;
77 this.hitsplatDelay = hitsplatDelay;
81 this(name, maxHit, effect, animation, start, end, projectile, -1, -1);
112 public int getClientTicks() {
113 return projectile ==
null ? 0 : projectile.getClientTicks();
116 public int getServerTicks() {
117 return GameEngine.clientTicksToServerTicks(getClientTicks());
120 public int sendProjectile(
Mob attacker,
Mob defender) {
121 if (projectile ==
null)
return 0;
127 final String name = getName();
128 if (
"Ice Barrage".equals(name) ||
"Ice Burst".equals(name)
129 ||
"Smoke Barrage".equals(name) ||
"Smoke Burst".equals(name)) {
133 projectile.send(attacker, defender);
136 return getClientTicks();
139 public static CombatProjectile getDefinition(String name) {
140 return definitions.get(name);
143 public String getName() {
147 public int getMaxHit() {
151 public Optional<CombatImpact> getEffect() {
152 return Optional.ofNullable(effect);
155 public Optional<Animation> getAnimation() {
156 return Optional.ofNullable(animation);
159 public Optional<Graphic> getStart() {
160 return Optional.ofNullable(start);
163 public Optional<Graphic> getEnd() {
164 return Optional.ofNullable(end);
167 public OptionalInt getHitDelay() {
168 if (hitDelay == -1) {
169 return OptionalInt.empty();
171 return OptionalInt.of(hitDelay);
174 public OptionalInt getHitsplatDelay() {
175 if (hitsplatDelay == -1) {
176 return OptionalInt.empty();
178 return OptionalInt.of(hitsplatDelay);
181 public Optional<Projectile> getProjectile() {
182 return Optional.ofNullable(projectile);
185 public static final class ProjectileBuilder {
189 public byte startHeight;
190 public byte endHeight;