RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
Skotizo.java
1package com.osroyale.game.world.entity.combat.strategy.npc.boss.skotizo;
2
3import com.osroyale.game.Animation;
4import com.osroyale.game.Graphic;
5import com.osroyale.game.Projectile;
6import com.osroyale.game.UpdatePriority;
7import com.osroyale.game.world.World;
8import com.osroyale.game.world.entity.combat.CombatType;
9import com.osroyale.game.world.entity.combat.attack.FightType;
10import com.osroyale.game.world.entity.combat.hit.CombatHit;
11import com.osroyale.game.world.entity.combat.hit.Hit;
12import com.osroyale.game.world.entity.combat.projectile.CombatProjectile;
13import com.osroyale.game.world.entity.combat.strategy.CombatStrategy;
14import com.osroyale.game.world.entity.combat.strategy.npc.MultiStrategy;
15import com.osroyale.game.world.entity.combat.strategy.npc.NpcMagicStrategy;
16import com.osroyale.game.world.entity.combat.strategy.npc.NpcMeleeStrategy;
17import com.osroyale.game.world.entity.mob.Mob;
18import com.osroyale.game.world.entity.mob.npc.Npc;
19import com.osroyale.game.world.position.Position;
20import com.osroyale.game.world.region.RegionManager;
21import com.osroyale.util.RandomUtils;
22import com.osroyale.util.Utility;
23
24import static com.osroyale.game.world.entity.combat.CombatUtil.createStrategyArray;
25import static com.osroyale.game.world.entity.combat.CombatUtil.randomStrategy;
26
68
69public class Skotizo extends MultiStrategy {
70 private static Magic MAGIC = new Magic();
71 private static LightingRain LIGHTNING_RAIN = new LightingRain();
72 private static TeleGrab TELE_GRAB = new TeleGrab();
73
74 private static final CombatStrategy<Npc>[] FULL_STRATEGIES = createStrategyArray(NpcMeleeStrategy.get(), MAGIC, TELE_GRAB, LIGHTNING_RAIN);
75 private static final CombatStrategy<Npc>[] MAGIC_STRATEGIES = createStrategyArray(MAGIC, MAGIC, MAGIC,TELE_GRAB, LIGHTNING_RAIN);
76
77 private static final String[] SHOUTS = {
78 "Feel the wrath of Skotizo!",
79 "The dark times have come for you all!"
80 };
81
83 public Skotizo() {
84 currentStrategy = MAGIC;
85 }
86
87 @Override
88 public boolean canAttack(Npc attacker, Mob defender) {
89 if (!currentStrategy.withinDistance(attacker, defender)) {
90 currentStrategy = randomStrategy(MAGIC_STRATEGIES);
91 }
92 return currentStrategy.canAttack(attacker, defender);
93 }
94
95 @Override
96 public void block(Mob attacker, Npc defender, Hit hit, CombatType combatType) {
97 currentStrategy.block(attacker, defender, hit, combatType);
98 defender.getCombat().attack(attacker);
99
100 if (!defender.getCombat().isAttacking()) {
101 defender.animate(new Animation(69, UpdatePriority.VERY_HIGH));
102 defender.graphic(481);
103 defender.speak("ARHHHH! TIME TO SWITCH IT UP!!");
104 }
105 }
106
107 @Override
108 public void finishOutgoing(Npc attacker, Mob defender) {
109 currentStrategy.finishOutgoing(attacker, defender);
110 if (NpcMeleeStrategy.get().withinDistance(attacker, defender)) {
111 currentStrategy = randomStrategy(FULL_STRATEGIES);
112 } else {
113 currentStrategy = randomStrategy(MAGIC_STRATEGIES);
114 }
115 }
116
117 @Override
118 public int getAttackDelay(Npc attacker, Mob defender, FightType fightType) {
119 return attacker.definition.getAttackDelay();
120 }
121
123 private static class Magic extends NpcMagicStrategy {
124 public Magic() {
125 super(CombatProjectile.getDefinition("EMPTY"));
126 }
127
128 @Override
129 public void hit(Npc attacker, Mob defender, Hit hit) {
130 }
131
132 @Override
133 public void attack(Npc attacker, Mob defender, Hit hit) {
134 }
135
136 @Override
137 public void start(Npc attacker, Mob defender, Hit[] hits) {
138 Projectile projectile = new Projectile(1242, 50, 80, 85, 25);
139 attacker.animate(new Animation(69, UpdatePriority.VERY_HIGH));
140 RegionManager.forNearbyPlayer(attacker, 16, other -> {
141 projectile.send(attacker, other);
142 World.schedule(2, () -> other.damage(nextMagicHit(attacker, other, 38)));
143 });
144
145 if (Utility.random(0, 2) == 1)
146 attacker.speak(Utility.randomElement(SHOUTS));
147 }
148
149 @Override
150 public CombatHit[] getHits(Npc attacker, Mob defender) {
151 CombatHit hit = nextMagicHit(attacker, defender, 38);
152 hit.setAccurate(false);
153 return new CombatHit[]{hit};
154 }
155
156 @Override
157 public int modifyAccuracy(Npc attacker, Mob defender, int roll) {
158 return roll + 50_000;
159 }
160 }
161
162 private static class TeleGrab extends NpcMagicStrategy {
163 TeleGrab() {
164 super(CombatProjectile.getDefinition("EMPTY"));
165 }
166
167 @Override
168 public void hit(Npc attacker, Mob defender, Hit hit) {
169 }
170
171 @Override
172 public void attack(Npc attacker, Mob defender, Hit hit) {
173 }
174
175 @Override
176 public void start(Npc attacker, Mob defender, Hit[] hits) {
177 attacker.animate(new Animation(69, UpdatePriority.VERY_HIGH));
178 attacker.graphic(481);
179 attacker.speak("ARHHHH! TIME TO SWITCH IT UP!!");
180 }
181
182 @Override
183 public CombatHit[] getHits(Npc attacker, Mob defender) {
184 CombatHit hit = nextMagicHit(attacker, defender, 38);
185 hit.setAccurate(false);
186 return new CombatHit[]{hit};
187 }
188 }
189
190 private static class LightingRain extends NpcMagicStrategy {
191 LightingRain() {
192 super(CombatProjectile.getDefinition("Vet'ion"));
193 }
194
195 @Override
196 public void hit(Npc attacker, Mob defender, Hit hit) {
197 }
198
199 @Override
200 public void attack(Npc attacker, Mob defender, Hit hit) {
201 }
202
203 @Override
204 public void start(Npc attacker, Mob defender, Hit[] hits) {
205 attacker.animate(new Animation(69, UpdatePriority.VERY_HIGH));
206 attacker.speak("YOU WILL NOW FEEL THE TRUE WRATH OF SKOTIZO!");
207
208 RegionManager.forNearbyPlayer(attacker, 16, other -> {
209 Position position = other.getPosition();
210 combatProjectile.getProjectile().ifPresent(projectile -> World.sendProjectile(attacker, position, projectile));
211
212 World.schedule(2, () -> {
213 World.sendGraphic(new Graphic(775), position, attacker.instance);
214 if (other.getPosition().equals(position)) {
215 other.damage(new Hit(Utility.random(20, 50)));
216 other.speak("OUCH!");
217 other.message("Skotizo has just electrocuted your entire body! Don't stay in one spot!");
218 }
219 });
220 });
221 }
222
223 @Override
224 public CombatHit[] getHits(Npc attacker, Mob defender) {
225 CombatHit hit = nextMagicHit(attacker, defender, 38);
226 hit.setAccurate(false);
227 return new CombatHit[]{hit};
228 }
229 }
230}
void speak(String forceChat)
Definition Mob.java:164