Tom_Kazansky
--- wraith it ! ---
- Reaction score
- 157
I'm sorry if the title isn't clear. In my mind, these things are... vague, I don't know exactly what I should ask :banghead:
I develop an Attack/Spell System for my map but somehow I feel it still lacking some thing, maybe my "theory" isn't right.
here goes:
? Attack System:
¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Basically, my system works like this:
(*) the mentioned functions (for attacker and attacked unit) are run using function interface, I use AutoData to attach them to units.
I used to hard-code these but that's inefficient so I use function interface, run fucntions for specific unit.
and here are my problems:
? Spell System: (this is not really a "system" but well, I will just use the word)
¯¯¯¯¯¯¯¯¯¯¯¯¯
so, errm, my spell would work like the following:
for (1),(2),(3),(4) I have functions that take a set number of arguments that describe the spell and when I want more arguments (more detailed) I have to fix the code; yes, very tiring
so the solution should be using a struct instead?
and I need suggestions about the... name for "properties" of the spell (you probably think this is what I have to do by myself but I can't really think of some things "ok" right now), currently I have:
should I make this like the Attack System above? (lol)
----
phew, I feel so relived after writing all this. (I will be happier if I have my problem solved, though )
thank you for reading!
I develop an Attack/Spell System for my map but somehow I feel it still lacking some thing, maybe my "theory" isn't right.
here goes:
? Attack System:
¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Basically, my system works like this:
- [Attack Detect] A unit is attacked: create Attack Object with attacker and attacked unit along with other data
- [onAttack] Right after above event, I called it "onAttack" event: during this, runs some functions (*) for attacker and attacked unit with Attack Object as an argument.
(this is for the purpose of play animation for ability such as critical strike, bash, pulverize) - [Wait Animation] Now I use timer to "wait" for the attacker to finish its "animation damage point" time
- [onDamagePoint] The "onDamagePoint" event occur: during this, run functions (*) for attacker and attacked unit (with Attack Object as an argument).
These fucntions are: "miss check" functions and, then, ability functions. (auto-cast abilities, buff that count attacks,...) - [Attack Process] After that, calculate damage of the attack and process the attack
If the attack is: (melee and ranged attack for the moment)- Melee: run function that does damage of the attack (let just call this: "Attack Hit")
- Range: run function that create projectile from attacker to attacked unit ---> projectile hit: run function that does damage of the attack
- [Attack Hit] check damage (mainly, Crit), deal damage, run functions (*) for attacker and attacked unit
(*) the mentioned functions (for attacker and attacked unit) are run using function interface, I use AutoData to attach them to units.
I used to hard-code these but that's inefficient so I use function interface, run fucntions for specific unit.
and here are my problems:
- onAttack, onDamagePoint at some cases, there are abilities that are "not stacked" with others (e.g: Orb Effects) but I don't know if one of these abilities has been "actived" or not.
example: I have ability A and B which are actived at "onDamagePoint", but these two are not stacked with each other (if one has effect, other must not)
my solution: create a variable (member) in the Attack Object. But I don't like this way very much, it's nearly "hard-coded"
so, any suggestions for this?
- on "miss check": this will check evasion abilities of attacked unit and "accuracy" of attacker. Generally, evasion abilities do not stack with each other, so single ability check is fine but if I want one ability (or more) to stack -> "single ability check" does not work.
my solution: create a variable (member) in the Attack Object (again). This will have the "chance to miss" of the stacking ability in it and then all the other abilities will have their chance + this stacking chance
is this ok?
- A problem regards "count attack ability" and "effect ability": when I want an attack that does not have any "special bonus" (effect ability such as critical strike, bash,...), I just don't run the functions at "onAttack" or "onDamagePoint"
because of that, some "count attack ability" are not checked as well (it should be checked instead), right?
my solution: gives the functions that are run at "onAttack" or "onDamagePoint" a priority and check to run functions that have: minPriorty < funcPriority < maxPriority
(the "priority" name here is silly, I know)
so: "effect ability" will have priority higher than "count attack ability" -> this works
I'm pretty satisfied with this but I'm still looking for another way.
? Spell System: (this is not really a "system" but well, I will just use the word)
¯¯¯¯¯¯¯¯¯¯¯¯¯
so, errm, my spell would work like the following:
- Single Target spells:
- (1) run a function to check if the caster "missed" -> yes = do nothing
- (2) run a function to check if the spell is "reflected" (back to caster) (In case of missile spell, this will check when the missile hit target) -> yes = swap caster & target
- (3) run a function to check if the target can "resist" the spell -> yes = do nothing
- (4) before target takes effect/damage from spell, run an "onHit" function (yes, caster hit target with the spell)
- do effect/damage to the target
- Area of Effect (No Target, Ground Target) spells:
- (3) run a function to check if the affected units can "resist" the spell -> yes = do nothing
- (4) before affected units take effect/damage from spell, run an "onHit" function (yes, caster hit affected units with the spell)
- do effect/damage to affected units
for (1),(2),(3),(4) I have functions that take a set number of arguments that describe the spell and when I want more arguments (more detailed) I have to fix the code; yes, very tiring
so the solution should be using a struct instead?
and I need suggestions about the... name for "properties" of the spell (you probably think this is what I have to do by myself but I can't really think of some things "ok" right now), currently I have:
- caster
- target
- ability
- level
- element (Fire, Cold,...)
- affection type (the name is :nuts: single target, area of effect,... (any suggestions for this name?)
- "what does the spell do" eek: damage, debuff, dot,... (any suggestions for this name?)
should I make this like the Attack System above? (lol)
----
phew, I feel so relived after writing all this. (I will be happier if I have my problem solved, though )
thank you for reading!