|
Post by StatManCat on Oct 30, 2018 7:11:57 GMT
I have a status effect that will give a boost to a stat. I want to be able to have for example a plus ten to attack. This works perfect with my script. I can have an archer for example power up a shot for one turn and have an extra strong attack once. The issue however is that if I have another character give the archer a defense boost for example, since it is the same status the first gets priority and the defense boost does not happen it seems.
Any idea if we can make the same status stackable? I could also stack a poison for example to show heavily poisoned.
|
|
|
Post by Admin on Oct 30, 2018 16:23:37 GMT
Can you post the problem code? I see no reason why a status boost to attack should interfere with a status boost to defense, or why you couldn't boost attack with multiple status effects.
|
|
|
Post by Admin on Oct 31, 2018 2:12:17 GMT
Oh, are you trying to apply multiple status effects with a single ability? Because of the way that abilities are put together, such as using GetComponent it will just grab the first, and only the first component it finds. You can work around that in a couple of ways, such as by using GetComponents (note the plural form) but that would be a bit of work on your part to implement. Another probably simpler option is to make a new subclass of base ability effect that holds an array of things to do. For example, you could make an "InflictAbilitiesEffect" that holds an array of statusNames instead of just a single string. Then loop over the array inside the OnApply method to apply all of the effects all at once. You could probably do similar structures to modify a bunch of stats, or to come up with a deeper object hierarchy so you could do a compound ability effect where each has its own target and hit rate and everything. Does that help?
|
|
|
Post by StatMan on Oct 31, 2018 5:58:02 GMT
Hey, yea that is what I meant. I have one status effect script. I use that for applying a single stat boost skill. I apply a power boost, then the stat needed is read from a different file added to the ability itself.
For now I simply made a new one for each stat I want to be able to change. This way I can use the original if it is only a single stat that will change. I can use the others for item effects. (A bomb might burn for example, and cause blind for two turns at the same time.) Other issue though, my archer attack seems to sometimes count as hitting twice, doing more damage than it says under the hit rate. Also, sometimes the status duration disappears faster than I thought the round is starting. Is there a place you would recommend adding a debug to see when a turn is starting?
|
|
|
Post by Admin on Oct 31, 2018 13:26:03 GMT
An attack uses hit rate to determine whether or not ability's effect will be applied to the intended target, not how many times a hit is applied. Take a look at the "BaseAbilityEffect" scripts "Apply" method. It will use the HitRate component to "RollForHit" to see if a hit connects and post a relevant notification based on the result. Also look at the "DamageAbilityEffect" subclass which is where the "OnApply" method actually causes damage from a hit to modify a target unit's hit points.
For the status duration / round starting, take a look at the script "DurationStatusCondition" - it observes a notification - "TurnOrderController.RoundBeganNotification". You could observe the notification here, or go into the "TurnOrderController" script itself and look at the "Round" method where the notifications are actually posted.
|
|