RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
Hit.java
1package com.osroyale.game.world.entity.combat.hit;
2
3import java.util.function.Function;
4
43
44public class Hit {
45
47 private int damage;
48
50 private Hitsplat hitsplat;
51
53 private HitIcon hitIcon;
54
56 private boolean accurate;
57
58 private Hit[] multipleHits = null;
59
65 public Hit(Hit[] multipleHits) {
66 this.multipleHits = multipleHits;
67 int totalDamage = 0;
68 for(Hit hit : multipleHits) totalDamage += hit.damage;
69 this.damage = totalDamage;
70 }
71
80 public Hit(int damage, Hitsplat hitsplat, HitIcon hitIcon, boolean accurate) {
81 this.damage = damage;
82 this.hitsplat = hitsplat;
83 this.hitIcon = hitIcon;
84 this.accurate = accurate;
85 }
86
94 public Hit(int damage, Hitsplat hitsplat, HitIcon hitIcon) {
95 this(damage, hitsplat, hitIcon, damage > 0);
96 }
97
104 public Hit(int damage, HitIcon hitIcon) {
105 this(damage, Hitsplat.NORMAL, hitIcon, damage > 0);
106 }
107
114 public Hit(int damage, Hitsplat hitsplat) {
115 this(damage, hitsplat, HitIcon.NONE, damage > 0);
116 }
117
123 public Hit(int damage) {
124 this(damage, Hitsplat.NORMAL, HitIcon.NONE, damage > 0);
125 }
126
132 public void setDamage(int damage) {
133 this.damage = damage;
134 }
135
142 public void modifyDamage(Function<Integer, Integer> modifier) {
143 damage = modifier.apply(damage);
144
145 if (damage <= 0) {
146 damage = 0;
147 }
148 }
149
155 public int getDamage() {
156 return damage;
157 }
158
165 return hitsplat;
166 }
167
174 return hitIcon;
175 }
176
182 public boolean isAccurate() {
183 return accurate;
184 }
185
186 public Hit[] getMultipleHits() { return multipleHits; }
187
193 public void setIcon(HitIcon hitIcon) {
194 this.hitIcon = hitIcon;
195 }
196
197 public void setHitsplat(Hitsplat hitsplat) {
198 this.hitsplat = hitsplat;
199 }
200
201 public void setAs(Hit other) {
202 this.damage = other.damage;
203 this.hitIcon = other.hitIcon;
204 this.hitsplat = other.hitsplat;
205 this.accurate = other.accurate;
206 }
207
208 public void setAccurate(boolean accurate) {
209 this.accurate = accurate;
210 }
211}
Hit(int damage, Hitsplat hitsplat, HitIcon hitIcon)
Definition Hit.java:94
Hit(int damage, Hitsplat hitsplat, HitIcon hitIcon, boolean accurate)
Definition Hit.java:80
Hit(int damage, Hitsplat hitsplat)
Definition Hit.java:114
Hit(int damage, HitIcon hitIcon)
Definition Hit.java:104
void modifyDamage(Function< Integer, Integer > modifier)
Definition Hit.java:142