This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
user:loggy:castingai [2021/06/30 03:00] loggy |
user:loggy:castingai [2023/02/24 19:01] (current) loggy fairly important note those self buffing resists |
||
---|---|---|---|
Line 6: | Line 6: | ||
The battlefield location array seems to be stored with offsets of %%((coord2 * 200) + coord 1) * 0x20%% | The battlefield location array seems to be stored with offsets of %%((coord2 * 200) + coord 1) * 0x20%% | ||
+ | Or is it? | ||
+ | |||
+ | When looking for specific units in squares, it's instead %%(index, 0-7 inclusive + ((coord2 * 200) + coord1) * 8)%% | ||
Line 25: | Line 28: | ||
* 4, cause fear type 1 [1] | * 4, cause fear type 1 [1] | ||
* 7, poison damage [1] | * 7, poison damage [1] | ||
- | * 8, remove fatigue? [0] | + | * 8, remove fatigue? [-1] |
* 9, undocumented | * 9, undocumented | ||
- | * 10, bless/buff type 1 [0] | + | * 10, bless/buff type 1 [-1] |
* 11, cause affliction [1] | * 11, cause affliction [1] | ||
- | * 13, heal [0] | + | * 13, heal [-1] |
- | * 23, buff type 2 [0] | + | * 23, buff type 2 [-1] |
* 24, damage x3 vs demon/ | * 24, damage x3 vs demon/ | ||
* 28, enslave [1] | * 28, enslave [1] | ||
Line 97: | Line 100: | ||
* If the spell is more than lingering 4, multiply the score by 3. If it is lingering 2 or 3, multiply by 2 instead. | * If the spell is more than lingering 4, multiply the score by 3. If it is lingering 2 or 3, multiply by 2 instead. | ||
* If the score is greater than zero: | * If the score is greater than zero: | ||
- | * Calculate a new score: ((closed d120 + 40) * old score) / 100, rounded down. If this value is less than 10, set it to be 10. | + | * Calculate a new score: |
* Some stuff I don't understand that cares about the spell range | * Some stuff I don't understand that cares about the spell range | ||
* If the spell effect was 126 (call horror), the score is set to d10 exploding or the actual score, whichever is lower. | * If the spell effect was 126 (call horror), the score is set to d10 exploding or the actual score, whichever is lower. | ||
Line 125: | Line 128: | ||
* Any other enchantment, | * Any other enchantment, | ||
* Other types of spells: | * Other types of spells: | ||
+ | * If the spell' | ||
+ | * Add up spellunitscores for all units on the field | ||
+ | * Add an exploding d10 to this and use it as the final score | ||
* If the spell is self target only, just consider the caster. | * If the spell is self target only, just consider the caster. | ||
* Work out how many units the effect could usefully target (check every square, add up the number of targets in them), depending on whether it is offensive (look at enemies) or nonoffensive (look at friends). Make a copy of this value called the " | * Work out how many units the effect could usefully target (check every square, add up the number of targets in them), depending on whether it is offensive (look at enemies) or nonoffensive (look at friends). Make a copy of this value called the " | ||
Line 132: | Line 138: | ||
* If reduced squares is 12+: if min(300, reduced squares) <= closed d300 + 9, check this square. [there is a (squares-9)/ | * If reduced squares is 12+: if min(300, reduced squares) <= closed d300 + 9, check this square. [there is a (squares-9)/ | ||
* If the square being considered is out of range, skip it. | * If the square being considered is out of range, skip it. | ||
- | * Calc some values based on range, aoe, and precision | + | * Calc some values based on range, aoe, and precision: |
- | * | + | * If the spell' |
+ | * square spread = 2 | ||
+ | * accurate square weight = (max(1, aoe) * number of effects * 200)/26 | ||
+ | * inaccurate square weight = (max(1, aoe) * number of effects * 100)/26 | ||
+ | * If the spell' | ||
+ | * square spread = 1 | ||
+ | * accurate square weight = max(1, aoe) * number of effects * 20 | ||
+ | * inaccurate square weight = max(1, aoe) * number of effects * 10 | ||
+ | * If the final precision is 90+ OR the distance being aimed at is less than (final prec/3): | ||
+ | * square spread = 0 | ||
+ | * accurate square weight = 100 | ||
+ | * inaccurate square weight = 0 | ||
+ | * If the distance being aimed is less than (final prec/2): | ||
+ | * square spread = 1 | ||
+ | * accurate square weight = 36 | ||
+ | * inaccurate square weight = 8 | ||
+ | * All other cases: | ||
+ | * square spread = 1 | ||
+ | * accurate square weight = 68 | ||
+ | * inaccurate square weight = 4 | ||
+ | * Check a square of tiles containing units. This square is made up of the picked square, plus (square spread) tiles in each cardinal direction [a square with side lengths (2 * square spread) + 1]. For each square within the big square: | ||
+ | * Sum the unit scores of the things in that square. | ||
+ | * If there was more than one thing in the square, and the spell affects only 1 person, divide the summed score by the number of units in the square | ||
+ | * If the square struck was the originally picked square at the centre of the square spread (and not the extra ones around it), add (this square' | ||
+ | * If the total score from all the squares is greater than 0: | ||
+ | * score = max(1, -5 + closed d10 + (score / 100)) [This divides the weighting multiplied scores from the above by 100 regardless of which spread/ | ||
+ | * If the spell is being aimed less than 10 squares from the caster, and the spell is an offensive effect number (effects that returned 1 on the list somewhere above) | ||
+ | * score = max(1, (score * 10)/max(2, distance from caster)) | ||
+ | * Otherwise: | ||
+ | * If the spell' | ||
+ | * score = max(1, (score * 10)/max(10, distance from caster)) | ||
+ | * Other cases: | ||
+ | * score = max(1, (score * 15)/max(15, distance from caster)) | ||
+ | * Compare the final score casting the spell at this position to the based saved one. If it's better, take this as the new best. | ||
+ | * Regardless of your spell' | ||
+ | * score = %%max(1, (open d10 + ((open d40 + 80) * score)/100 - 5)%% | ||
* Calculate a final score: (score * 100) / (fatigue from cast, not including encumbrance + 90) and round down. | * Calculate a final score: (score * 100) / (fatigue from cast, not including encumbrance + 90) and round down. | ||
* If over 75 fatigue and casting a reinvigoration spell (effect 8 only): | * If over 75 fatigue and casting a reinvigoration spell (effect 8 only): | ||
Line 165: | Line 206: | ||
* If combat round 2+, this is always 1. | * If combat round 2+, this is always 1. | ||
* In assassination, | * In assassination, | ||
- | * In other cases, this is (2 - round) | + | * In other cases, this is (2 - round)*2 |
Self buff bias is 2 if the caster is the spell' | Self buff bias is 2 if the caster is the spell' | ||
Line 239: | Line 280: | ||
* Otherwise, add (1 - victim' | * Otherwise, add (1 - victim' | ||
- | If the current damage value is greater than (victim' | + | If the current damage value is greater than (victim |
If the spell offers either (or both) an easy or hard MR check: | If the spell offers either (or both) an easy or hard MR check: | ||
Line 245: | Line 286: | ||
* If the spell offers an easy mr check, consider victim' | * If the spell offers an easy mr check, consider victim' | ||
* If the spell does not offer a normal MR check, and (user' | * If the spell does not offer a normal MR check, and (user' | ||
- | * If the spell offers a normal MR check: | + | * If the spell offers a normal MR check, do the first one that applies: |
- | * if (mr > pen bonus + 8), do nothing to damage | + | * if (mr >= pen bonus + 23), divide |
- | * if (mr < pen bonus + 11), multiply | + | * if (mr >= pen bonus + 20), divide |
- | * if (mr < pen bonus + 14), divide damage by 2 | + | * if (mr >= pen bonus + 17), divide damage by 6 |
- | * if (mr < pen bonus + 17), divide damage by 6 | + | * if (mr >= pen bonus + 14), divide damage by 3 |
- | * if (mr < pen bonus + 20), divide damage by 12 | + | * if (mr >= pen bonus + 11), divide damage by 2 |
- | * if (mr < pen bonus + 23), divide | + | * if (mr >= pen bonus + 8), multiply |
+ | * Otherwise, do nothing to damage | ||
If MR check for half damage, multiply damage by 2/3 [shouldn' | If MR check for half damage, multiply damage by 2/3 [shouldn' | ||
Line 257: | Line 299: | ||
If spell is defence negate OR (is not AoE and does not ignore shields), multiply damage by 2/3 [couldn' | If spell is defence negate OR (is not AoE and does not ignore shields), multiply damage by 2/3 [couldn' | ||
- | Look up the victim' | + | Look up the victim' |
If the effect is buff type 1: | If the effect is buff type 1: | ||
Line 364: | Line 406: | ||
* score = max(10, 20 - victim' | * score = max(10, 20 - victim' | ||
* If the spell confers invuln 25: | * If the spell confers invuln 25: | ||
- | * If the recipient' | + | * If the recipient' |
* Otherwise, score = friendly bias | * Otherwise, score = friendly bias | ||
* If the spell confers invuln 15 and does not confer invuln 25: | * If the spell confers invuln 15 and does not confer invuln 25: | ||
- | * If the recipient' | + | * If the recipient' |
* Otherwise, score = friendly bias | * Otherwise, score = friendly bias | ||
* If the spell confers invuln 15 to wolves only, and neither of the two above invuln effects, and the victim is a wolf: | * If the spell confers invuln 15 to wolves only, and neither of the two above invuln effects, and the victim is a wolf: | ||
- | * If the recipient' | + | * If the recipient' |
* Otherwise, score = friendly bias | * Otherwise, score = friendly bias | ||
* If the spell confers power of the spheres: | * If the spell confers power of the spheres: | ||
Line 401: | Line 443: | ||
* score = current HP * friendly bias * early buff bias * 5 | * score = current HP * friendly bias * early buff bias * 5 | ||
* If the spell confers swiftness, and the recipient is not immobile: | * If the spell confers swiftness, and the recipient is not immobile: | ||
- | * score = ((current HP + 1)*friendly bias * early buff bias)/2 | + | * score = %%((current HP + 1)*friendly bias * early buff bias)/2%% |
* If the spell confers hell power: | * If the spell confers hell power: | ||
* score = current HP * friendly bias * early buff bias | * score = current HP * friendly bias * early buff bias | ||
Line 488: | Line 530: | ||
* score = (current HP * - friendly bias * 3)/2 | * score = (current HP * - friendly bias * 3)/2 | ||
- | ... [more spell effects | + | For the following |
+ | * 2 damage | ||
+ | * 24 x3 vs undead or demons | ||
+ | * 73 x2 vs magic beings | ||
+ | * 96 shatter damage | ||
+ | * 99 petrify | ||
+ | * 105 disbelieve dmg | ||
+ | * 107 x2 vs demon | ||
+ | * 109 capped dmg | ||
+ | * 124 undocumented | ||
+ | * 134 chain lightning | ||
+ | * 142 salt damage | ||
+ | |||
+ | score = strength value * - friendly bias * 10 | ||
+ | * For unlife damage or unlife damage x2 vs magic beings: | ||
+ | * score = strength value * - friendly bias * 10 | ||
+ | * If the victim is not inanimate and not undead, add 25 | ||
+ | * For magic duel: | ||
+ | * score = min(10, strength value) * - friendly bias | ||
+ | * For drain life: | ||
+ | * score = caster' | ||
+ | * For fear: | ||
+ | * If the victim is already routed, score 0 | ||
+ | * Otherwise, score = strength value * - friendly bias * 5 | ||
+ | * For poison HP damage and capped poison damage: | ||
+ | * score = strength value * - friendly bias * -8 | ||
+ | * For fatigue damage: | ||
+ | * score = (strength value * - friendly bias * victim max HP)/10, rounded down | ||
+ | * For interrupt damage: | ||
+ | * If the victim has no magic skill, score 0 [mundane commanders casting spells via items will not be targeted] | ||
+ | * score = (victim' | ||
+ | * For weakening spells: | ||
+ | * score = (9 - victim' | ||
+ | * For spells that directly add age: | ||
+ | * score = (19 - victim' | ||
+ | * For paralyze damage: | ||
+ | * If the victim is already paralyzed for 10+ ticks, OR (strength value/2) is less than paralysis ticks: | ||
+ | * score = 2 | ||
+ | * otherwise, score = (victim current HP * - friendly bias * strength value)/4 | ||
+ | * For stun/ | ||
+ | * If the victim is stun immune, score 0 | ||
+ | * If the victim is stunned for 2000-4999 ticks, score = 2 | ||
+ | * If the victim is stunned for 5000+ ticks, score = 0 | ||
+ | * Otherwise, score = victim current HP * - friendly bias * 2 | ||
+ | * For effects 500-599 (capped add unit effect) inclusive: | ||
+ | * If the victim does not have the effect already: | ||
+ | * If the spell confers damage reversal, score = victim current HP * friendly bias * 15 | ||
+ | * If the spell confers desiccation, | ||
+ | * If the spell confers anything else, score = 1 | ||
+ | * If the victim has the effect already at some magnitude **[NOTE: this checks TOTAL magnitude already, not what is in slots, which means that a unit that has 10 FR will refuse to put +10FR into their slots with these spells, despite the fact units will happily use the +5 buff until 20+]**: | ||
+ | * If the spell is trying to add less magnitude than the effect has already, score = 0 | ||
+ | * If the spell confers damage reversal, score = victim current HP * friendly bias * 10 | ||
+ | * If the spell confers desiccation, | ||
+ | * If the spell confers anything else, score = 1 | ||
+ | * For effects 600-699 (uncapped add unit effect) inclusive: | ||
+ | * If the spell horror marks: | ||
+ | * score = victim current HP * - friendly bias | ||
+ | * If the spell applies encase in ice, and the target' | ||
+ | * score = max(2, victim prot - 17) * victim current HP * - friendly bias | ||
+ | * If the victim already has any amount of encase in ice, score = above score / (encase in ice value / 20 + 2) | ||
+ | * Any other case scores 0 | ||
+ | * For stream of life: | ||
+ | * score = victim current HP * - friendly bias * 7 | ||
+ | * For enslave and charm: | ||
+ | * If the victim cannot be charmed, score = 0 | ||
+ | * score = strength value * - friendly bias * 20 | ||
+ | * For polymorph: | ||
+ | * score = max(1, strength value - 5) * - friendly bias * 10 | ||
+ | * For plane banishment: | ||
+ | * If the victim has no void sanity and there is a source of astral fetters on the battlefield, | ||
+ | * Otherwise, score = victim current HP * - friendly bias * 100 | ||
+ | * For healing spells: | ||
+ | * score = victim' | ||
+ | * For fatigue removal spells: | ||
+ | * score = (min(strength score, target' | ||
+ | * For the unused temp morale boost effect: | ||
+ | * If the recipient isn't routed: | ||
+ | * score = (5 - recipient' | ||
+ | * For returning: | ||
+ | * If some (TODO: what is this - looks like being in other planes) criteria, you get 0. Otherwise, 1. | ||
+ | * For blink: | ||
+ | * score = 1 | ||
+ | * For either kind of armour damage spells: | ||
+ | * TODO as with rust, insufficient current knowledge of how items and armor are handled | ||
+ | * Any other effects score 0 | ||
If the final score > 3, the victim is an enemy of the caster, and is immobilized, | If the final score > 3, the victim is an enemy of the caster, and is immobilized, |