Skip to content

Commit a27d906

Browse files
ChronokenTheComputerGeek2
authored andcommitted
Improved HomingMissileSpell.
Improved spell initialization
1 parent ee76f99 commit a27d906

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/com/nisovin/magicspells/spells/targeted/HomingMissileSpell.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -125,28 +125,28 @@ public HomingMissileSpell(MagicConfig config, String spellName) {
125125
public void initialize() {
126126
super.initialize();
127127

128-
Subspell s = new Subspell(hitSpellName);
129-
if (!s.process() && !hitSpellName.isEmpty()) {
130-
spell = s;
128+
spell = new Subspell(hitSpellName);
129+
if (!spell.process()) {
130+
spell = null;
131131
MagicSpells.error("HomingMissileSpell " + internalName + " has an invalid spell defined!");
132132
}
133133

134-
Subspell s2 = new Subspell(groundSpellName);
135-
if (!s2.process() && !groundSpellName.isEmpty()) {
136-
groundSpell = s2;
137-
MagicSpells.error("HomingMissileSpell " + internalName + " has an invalid spell-on-hit-ground defined!");
134+
groundSpell = new Subspell(groundSpellName);
135+
if (!groundSpell.process()) {
136+
groundSpell = null;
137+
if (!groundSpellName.isEmpty()) MagicSpells.error("HomingMissileSpell " + internalName + " has an invalid spell-on-hit-ground defined!");
138138
}
139139

140-
Subspell s3 = new Subspell(airSpellName);
141-
if (!s3.process() && !airSpellName.isEmpty()) {
142-
airSpell = s3;
143-
MagicSpells.error("HomingMissileSpell " + internalName + " has an invalid spell-on-hit-air defined!");
140+
airSpell = new Subspell(airSpellName);
141+
if (!airSpell.process()) {
142+
airSpell = null;
143+
if (!airSpellName.isEmpty()) MagicSpells.error("HomingMissileSpell " + internalName + " has an invalid spell-on-hit-air defined!");
144144
}
145145

146-
Subspell s4 = new Subspell(durationSpellName);
147-
if (!s4.process() && !durationSpellName.isEmpty()) {
148-
durationSpell = s4;
149-
MagicSpells.error("HomingMissileSpell " + internalName + " has an invalid spell-after-duration defined!");
146+
durationSpell = new Subspell(durationSpellName);
147+
if (!durationSpell.process()) {
148+
durationSpell = null;
149+
if (!durationSpellName.isEmpty()) MagicSpells.error("HomingMissileSpell " + internalName + " has an invalid spell-after-duration defined!");
150150
}
151151
}
152152

0 commit comments

Comments
 (0)