Hey, please provide a decent description of your spell.
Also you should add basic documentation. Especially when it comes
to configuration for the user, documentation becomes very important.
Sometimes it's better to use constant functions over constant values,
when it comes to certain aspects in configuration, for example for damage:
private static constant real DAMAGE = 20
->
JASS:
private constant function Damage takes integer level returns real
return 20. //*level for example can be used.
endfunction
x, and y coordinates of unit can stored into locals onCast.
In your
enum
you don't filter out for examle dead units.
You also might want filter for enemy units.
JASS:
private group targets
private group temp
private group swap
^Three groups for an instance can be avoided here.
Basicly:
Temporary enums only, then:
private static group myGroup
-> is completly enough. No need to destroy/re-create it over and over again.
Need to keep track of certain units for each instance, then:
private group myGroup
-> Now each instance has it's own group, that can be used for damage only once for example.
Your case is a bit special now, because you use the fresh swapping method
in combination with FoG loops. But here also static help groups can be used.
Read last chapter here:
http://www.hiveworkshop.com/forums/...on-using-first-group-loop-enumeration-223140/
When it comes to checks if an expression is true or false, you don't
need to compare it with
true
or
false
explicitly.
Just let the expression for true, and for false use
not
before it.
You also don't say "it is rainy == true" -> "it is
rainy"
You also don't say "it is rainy == false" -> "it is
not rainy"
The extra comparison becomes redundant.
this.tick1 == 32
-> I guess you want to wait 1 second. But as the timeout is configurable,
the value in comparison also should depend on it, and should not be a hardcoded constant.
private static timer iterator = CreateTimer()
^Nothing serious, but I personaly think "iterator" is a strange name for a timer variable.
I personaly would go with just something like "tim", or "clock".
Agents, and only agents need to be nulled when they fall out of scope.
You don't null groups onDeindex, but instead following operations are not needed:
JASS:
set this.infected = FALSE
set this.tick1 = 0
set this.tick2 = 0
set this.level = 0
set this.infections = 0
An instance should probably be deindex if
this.caster
is not in game/not alive anymore. (?)
I see you are new on hive, so welcome on THW!
Please read the post carefuly before next update
.