Page 1 of 1

Unit design - unit stat sheet - spell/convert probability

Posted: Sun Nov 14, 2021 6:48 pm
by Stratego (dev)
I have opened a topic on this as i have not remembered and checked in code:

Code: Select all

float grossCastProbability = converter.getChancePercentSum(ef); 
grossCastProbability = (float) Math.pow(grossCastProbability, numberOfTargetsAffecting);
probability = grossCastProbability * (1 - targets.resistance); 
if (targets.resistance >= 1)
    probability = 0;
after this code we take a random number in range [0..1] -> rndNum
and after:

Code: Select all

if (rndNum <= probability) 
  successful = true;
where:
grossCastProbability: this contains the caster and effect probability sum
probability = grossCastProbability * (1 - targets.resistance); -> this means if target resistances are negative than probability CAN be more than 1.

for example:
1:
grossProbability = 50% (eg. conversion probability)
targets.resistance = 10%
probability = 0.5 * ( 1 - 0.1) = 0.45 -> 45% (NOT sure success!)

2:
grossProbability = 50% (eg. conversion probability)
targets.resistance = -30%
probability = 0.5 * ( 1 - (-0.3)) = 0.65 -> 65% (still NOT yet sure success!)

3:
grossProbability = 50% (eg. conversion probability)
targets.resistance = -120%
probability = 0.5 * ( 1 - (-1.2)) = 1.1 -> 110% (sure success!)

Re: Unit design - unit stat sheet - spell/convert probability

Posted: Sun Nov 14, 2021 6:54 pm
by Endru1241
I remember asking for this specifically (mainly for AoS conversion).
Because conversion by default applies negative resistance on failure, so it will work eventually.
And that was the point - to not leave everything to chance but have some way for 100% chance of success, provided there is enough priests.

Re: Unit design - unit stat sheet - spell/convert probability

Posted: Sun Nov 14, 2021 6:57 pm
by Stratego (dev)
yes, i wrote it to show that a negative value will not ALWAYS mean SURE success, as it depends on initial caster probability too - but there is a point where it will be sure if it is negative AND its absolute value is big enough.

Re: Unit design - unit stat sheet - spell/convert probability

Posted: Mon Nov 15, 2021 4:44 pm
by makazuwr32
Just as i thought.
Only what was confusing me is at what step rnd is used and how.

During magic update we will reduce in aof spell chance for debuffs down to 70-80% at base (on ability) and +10% chance as extra per tier of spell power techs (given to caster) as well as reduce base spell resist to 0-20% for normal units (20% will be for elves, other races will have lower spell resist) and up to 40% base spell resist for elites (some exclusive units might get higher spell resist but that will not be common for all units) and some extra spell resist given by techs and and abilities.

Now with this info i can say for sure that these will be the numbers we will aim for.

Re: Unit design - unit stat sheet - spell/convert probability

Posted: Mon Nov 15, 2021 5:57 pm
by Endru1241
Be aware of how chance is reduced for carriers as targets with more units inside.
It can change much for elves.
Both:
- carrier and carried units resistances sum
- chance is raised by the power of total number of units inside +1, so reduced for chance < 100%

Re: Unit design - unit stat sheet - spell/convert probability

Posted: Mon Nov 15, 2021 7:21 pm
by makazuwr32
Wait what.
Can we change this mechanic?

We will not allow to convert carriers specifically in aof so it is fine and even more it will be better if carrier will not be affected by effects and stats of carried units.
Carrier and carried units are different targets in aof and if you target carrier with for example damaging ability than only spell resist of carrier must be counted in, not spell resist of carried units.

Especially this mechanic is bad if it works for alternative resistances — hp depending and attack depending ones.

Not that this update to magic and abilities in general will come in anytime soon. Not in next 6 months at least.
So we have time to discuss and update this system the way we need.

Re: Unit design - unit stat sheet - spell/convert probability

Posted: Mon Nov 15, 2021 7:42 pm
by Endru1241
Why not?
If spell resistance is something mystical, that can nullify aoe spell - why wouldn't carried units contribute toward such?
Tower would surely be harder to destroy if few mages defended in it than when it would be few warriors instead.

Multiplying the chance by itself as many times as there is carried units although seems like more of a conversion thing.
Because they are not strictly targets for e.g. spell damaging tower.

Actually I am not 100% sure if numberOfTargetsAffecting is actually more than 1 in case other effects, than conversion.
Or if it is - should it?
Maybe there should be some switch, as some effects fit and others don't to be affected by such.

Anyway - for conversion such mechanics work perfectly.
And just because AoF doesn't convert carriers doesn't mean whole formula should be changed.

Re: Unit design - unit stat sheet - spell/convert probability

Posted: Mon Nov 15, 2021 8:04 pm
by Stratego (dev)
Actually I am not 100% sure if numberOfTargetsAffecting is actually more than 1 in case other effects, than conversion.
that is only for "special effect convert" type ones.

Re: Unit design - unit stat sheet - spell/convert probability

Posted: Mon Nov 15, 2021 8:13 pm
by Endru1241
Stratego (dev) wrote: Mon Nov 15, 2021 8:04 pm
Actually I am not 100% sure if numberOfTargetsAffecting is actually more than 1 in case other effects, than conversion.
that is only for "special effect convert" type ones.
Is it the same with summing carried units resistance to target?

Re: Unit design - unit stat sheet - spell/convert probability

Posted: Mon Nov 15, 2021 8:22 pm
by Stratego (dev)
yes i talked about that

Re: Unit design - unit stat sheet - spell/convert probability

Posted: Tue Nov 16, 2021 3:09 am
by makazuwr32
Stratego (dev) wrote: Mon Nov 15, 2021 8:22 pm yes i talked about that
So for other cases spell resistance does not summing for carriers, right?

Re: Unit design - unit stat sheet - spell/convert probability

Posted: Tue Nov 16, 2021 3:16 am
by makazuwr32
Endru1241 wrote: Mon Nov 15, 2021 7:42 pm Why not?
If spell resistance is something mystical, that can nullify aoe spell - why wouldn't carried units contribute toward such?
Tower would surely be harder to destroy if few mages defended in it than when it would be few warriors instead.
Spell resistance is not an active thing but a passive thing (in aof at least) and it is better to describe as something related to armor or instinct.
So you must not be able to combine these for carriers for better spell resist. You can't give dodges for example to carrier from carried units. Same here.

As for mages and such inside tower — it will be a thing but it will be for some specific races and it will be an active ability, not a passive spe resist.

Re: Unit design - unit stat sheet - spell/convert probability

Posted: Tue Nov 16, 2021 6:02 am
by Endru1241
makazuwr32 wrote: Tue Nov 16, 2021 3:16 am
Endru1241 wrote: Mon Nov 15, 2021 7:42 pm Why not?
If spell resistance is something mystical, that can nullify aoe spell - why wouldn't carried units contribute toward such?
Tower would surely be harder to destroy if few mages defended in it than when it would be few warriors instead.
Spell resistance is not an active thing but a passive thing (in aof at least) and it is better to describe as something related to armor or instinct.
So you must not be able to combine these for carriers for better spell resist. You can't give dodges for example to carrier from carried units. Same here.

As for mages and such inside tower — it will be a thing but it will be for some specific races and it will be an active ability, not a passive spe resist.
If it's only passive, intrinsic resistance, then effects with special target and area (e.g. fireball ) work wrong.
Ok. Target resisted and spell isn't affecting it, but as it's not active disruption, dispel, absorbtion or anything like that - where does aoe damage disappear in that case?

Re: Unit design - unit stat sheet - spell/convert probability

Posted: Tue Nov 16, 2021 7:52 am
by Stratego (dev)
makazuwr32 wrote: Tue Nov 16, 2021 3:09 am
Stratego (dev) wrote: Mon Nov 15, 2021 8:22 pm yes i talked about that
So for other cases spell resistance does not summing for carriers, right?
exactly

Re: Unit design - unit stat sheet - spell/convert probability

Posted: Tue Nov 16, 2021 8:19 am
by makazuwr32
Endru1241 wrote: Tue Nov 16, 2021 6:02 am
makazuwr32 wrote: Tue Nov 16, 2021 3:16 am
Endru1241 wrote: Mon Nov 15, 2021 7:42 pm Why not?
If spell resistance is something mystical, that can nullify aoe spell - why wouldn't carried units contribute toward such?
Tower would surely be harder to destroy if few mages defended in it than when it would be few warriors instead.
Spell resistance is not an active thing but a passive thing (in aof at least) and it is better to describe as something related to armor or instinct.
So you must not be able to combine these for carriers for better spell resist. You can't give dodges for example to carrier from carried units. Same here.

As for mages and such inside tower — it will be a thing but it will be for some specific races and it will be an active ability, not a passive spe resist.
If it's only passive, intrinsic resistance, then effects with special target and area (e.g. fireball ) work wrong.
Ok. Target resisted and spell isn't affecting it, but as it's not active disruption, dispel, absorbtion or anything like that - where does aoe damage disappear in that case?
For now magical aoe damage always is dealt to units. No spell resist could affect magical aoe damaging spells in aof.
In future we want to implement magic armor that will simply reduce the damage from spells.
There will still be some abilities who will deal pure damage unaffected by any sorts of damage reduction though.

As for spell resistance — it will affect only debuffs: some chance to not get a debuff. It will be especially effective when we will add aoe debuff spells.