Right, but I'm operating on the assumption that the game isn't going to be balanced around my bezerker strategy. Which means, other humans in 1410 on lunatic are not going to have 1200+ power production. If we want anything aside from bezerkers/kill-all-the-ai-before-1408 strategies to work, then we have to assume that, for instance, the strongest AI might actually get 2 nodes. And the human won't have 13 nodes, they'll have 6. Which means instead of the AI having 1300 and me having 1200, the AI will have 1500 power production, and the human will have 800.
I don't think the human will ever overcome that kind of power disparity.
And obviously I can fortress strike the AI, but that's again, not due to my power production, that's due to resistance bonus + holy bonus with 6-7 bezerkers, windwalking at speed 5 (or 13 if you want to cheat and use Jaer.) Or 8 bezerkers if the opponent isn't sorcery. Not something I think we're balancing around.
The power production directly leads to number of enemy doomstacks, and the human simply can't keep up with that much power production - the AI in question, with 'only' 1300 power production, and no Aether Binding, had 450 casting skill in early 1410. That means they could summon almost an entire STACK of water elementals every turn. (They won't obviously, but, I have seen AI summon as many as 6 of their top creatures in one turn.)
On a different note: Sorcery conjunctions seem too strong when it appears in the 'late' game (late in this case being based on the best player power production, not an actual timeline). One conjunction (not sure how long it lasted, definitely less than a year) saw me gain a little over 200 casting skill (and as above, I wasn't in the lead for power production. Obviously I would have gained a little without the conjunction, and I built 2 or 3 amp towers in that time, but at least 75% of that was due to the conjunction; partially because I dropped everything to focus on skill. At the start it was more than 20 casting skill per turn.) Yes everyone gets it, but it means only people within about 20% of the best player power production are going to have a shot just because the lead player is going to skyrocket ahead of everyone else.
Or maybe sorcery conjunctions should make war with the strongest player(s) far more likely, in an effort to force them not to spend power production on skill?
On a different different note: Arnuz how do you keep them warped??? The last game I tried warp node against the AI, they never lasted more than 2 turns. (And even then, if I only warped one node at a time, it never lasted longer than a single turn, which meant it was more expensive for me to cast, than it was for the enemy to lose the production AND dispel it the next turn. I was a specialist, but they had aether binding, which effectively negate each other.)
I'm managing... Maybe it's because I've managed to grab more myrran nodes than the AI, with my fast strategy? As a result I'm actually stronger than the AIs in terms of production, after the warping. It'd be different in a few years or if I hadn't gone to grab some of the myrran nodes first.
Here's a save.
(October 23rd, 2017, 06:17)Nelphine Wrote: Right, but I'm operating on the assumption that the game isn't going to be balanced around my bezerker strategy. Which means, other humans in 1410 on lunatic are not going to have 1200+ power production. If we want anything aside from bezerkers/kill-all-the-ai-before-1408 strategies to work, then we have to assume that, for instance, the strongest AI might actually get 2 nodes. And the human won't have 13 nodes, they'll have 6. Which means instead of the AI having 1300 and me having 1200, the AI will have 1500 power production, and the human will have 800.
I don't think the human will ever overcome that kind of power disparity.
And obviously I can fortress strike the AI, but that's again, not due to my power production, that's due to resistance bonus + holy bonus with 6-7 bezerkers, windwalking at speed 5 (or 13 if you want to cheat and use Jaer.) Or 8 bezerkers if the opponent isn't sorcery. Not something I think we're balancing around.
The power production directly leads to number of enemy doomstacks, and the human simply can't keep up with that much power production - the AI in question, with 'only' 1300 power production, and no Aether Binding, had 450 casting skill in early 1410. That means they could summon almost an entire STACK of water elementals every turn. (They won't obviously, but, I have seen AI summon as many as 6 of their top creatures in one turn.)
You don't really need that much to fortress strike. You can also use 2 to 5 stacks of lower cost (prod+buff) units. The important is to damage units on every wave, something you can work into your tactic. You can also stay allied/pacted until the strike, and time the strike around that. And you can build a diplomacy strategy that complements well with your military strategy. The AIs can't do any of that. Sure there comes a time where the disparity in mana production makes it impossible even to navigate around the stacks, but again, that's the human's responsibility to avoid delaying so much.
We can differ on opinions on how strong the advantage should be. In any case, that's the good part of the game and the challenge there is to make it not too easy. The t40 issue is that there are only common spells available or relevant, and that by then anything that happens is up to luck... The luck of geographical boundaries, the luck of aggressive neighbours, the luck of neighbours with races that build military strength quickly, the luck of accessible nodes and lairs... All of that might well be part of the game, but if we add also the luck of doomstacks popping out from nothing without any possibility to be aware of them, we are way too far into dicerolls realm.
Maybe a totally different approach would be to give to each race a way to maintain situational awareness... What if, say, all cavalry had high scouting bonuses? It was used for that after all.
Quote: What if, say, all cavalry had high scouting bonuses? It was used for that after all.
Interesting idea but with doomstacks moving 3 tiles a turn it wouldn't help any. Sure, you get to see the stack a turn earlier which means you can...buy a swordsmen or maybe summon a hell hound to it but the kind of army you need to stop 6+ nagas won't make it there in that one turn 90% of the time.
Early game is certainly too random but not much can be done about that, at least on the terrain part. We've already altered diplomacy to make it much less likely the player finds themselves in a multi-front early war but obviously it's not possible to completely eliminate it. Enemy wizards are random by definition so not much can be done about that either - you either get enemies that your strategy is good against or not.
Sure, what I don't appreciate is having to need a "trick" - that's not a strategy. For me, draconian archers, my FM ghouls, Nelphine's life berserkers or catwalk's high speed shenanigans are all tricks. At lunatic, there's only tricks right now. Maybe that's intended? OK fair enought - although I'd content that if nothing should win lunatic then nothing shall, not just tricks shall - but at master? It's still mostly tricks as soon as you're not in luck (see the tests where we're forced to revert to tricks). So one way or another the luck can be beaten by tricks, not by strategy, which diminishes the strategy part.
Sorry if I repeat myself, but to leave this impasse the only way I see is:
1- nerf tricks till nothing can win lunatic
2- nerf t40 AI cheating till something can win lunatic again
3- boost longer term cheating to counter point 2
4- see what's going on, repeat if necessary
This needs dynamic cheating, which you've described as "p. hard". You mentioned something about making mana/gold cheating dynamic being not as difficult as skill some time ago... What's happened to that line of thought? I remember that you first mentioned that but then went on to say that the AI needs the mana, but that was before the changes to garrisons. Time to re-evaluate this?
1. The tricks listed generally are built from elements that are individually fine and cannot be nerfed, or abuse core game mechanics (such as military strength calculations) which cannot be improved further. Draconian (bowmen or otherwise) might be the exception that might need nerfing. Ghouls idk, I had no luck trying to play those. It's up for later testing, but honestly there is no room for nerfing ghouls either. Any weaker and they are just a bottom tier unplayable unit. They have 3 attack strength limited to 3 shots and poison 1, it doesn't go much lower than that.
2. We can either have AI that doesn't cheat and then fast strategies are the only thing in the game (because they crush the AI before they can defend themselves, why play ANYTHING else?), or we can have them cheat a lot and then fast strategies are the only thing in the game but to a lesser extent - as you currently observe.
The latter is clearly better for three reason :
-If the enemy isn't attacking you, slower strategies are playable
-Even if they do the amount of force needed to defend is not as much as that needed for attacking so it's not forcing the fast strategy as much as the alternative. Defender has an advantage.
-If the AI is the attacker, a lot of their units won't be relevant as they stay home defending cities. So the overall forces the player needs are lower.
3. See 2, if we don't reduce the early bonus there is no need for this.
Mana/gold cheating being dynamic is most likely doable but I haven't yet understood how it can help without putting the game back to that old state of "raze first 3 AI capitals before 1405 because fast races can, and playing anything else is just stupid and pointless."
Seriously, we have "early game tactics too powerful" and "late game tactics too weak" both listed as known problems we can't solve. Your suggestion escalates both of these problems by making early game offense work better and late game offense worse against the AI. So why are you so persistent about it?
Quote: I remember that you first mentioned that but then went on to say that the AI needs the mana, but that was before the changes to garrisons. Time to re-evaluate this?
What the AI does with the units once summoned has no relevance on it being unable to tell if it can afford summoning more or not. Nothing changed there.
I think for me, we have a list if tricks we can't do anything about. However, one of the BIG things that super heavy cheating is designed to stop is wasting AI mana - and making sure the AI never accidentally gets itself into a state where it can't afford its own troops.
The first, I'd like to consider a trick - if someone honestly wants to build dozens or hundreds of spearmen, no amount if cheating will prevent it, and any other valid strategy such as economic destruction is vastly more difficult to do - to the point that I consider city curses and warp node completely useless. (Even Armageddon + doomsday + meteor storm didn't noticeably hurt the AI except to get rid of piles of troops that I ignore and normally just move around until the site is defeated anyway - in other words it had no affect on gameplay).
The second concern, that the ai doesn't understand maintenance is valid - but I've never seen the AI on advanced or above come remotely close to being worried about resources (even when it buys amplifying towers) until I've fortress strikes them and taken at least 1/4 of their other cities. Only then does the AI begin to need to watch resources (not that it can watch its resources of course). And even then I've taken out so many troops, I don't see the AI disband a single threatening stack until I've taken out 90% of his cities.
To me that means there is leeway. Yes the AI needs cheating. But not to the gargantuan levels it currently has.
And I disagree with arnuz. I don't think the late game AI needs as much cheating any more than the early game. Tricks will beat the ai, even if you gave back 400% cheating bonuses. Not using tricks, the AI simply crushes the human, per my discussion on power production and casting skill.
Come on, making cheating dynamic doesn't mean zeroing it ("AI that doesn't cheat and then fast strategies are the only thing in the game "); it means reducing it somewhat at t40 but it can mean increasing it afterwards.
> What the AI does with the units once summoned has no relevance on it being unable to tell if it can afford summoning more or not. Nothing changed there.
Of course, but what it does with them has relevance to the number of units running around. If that's more than before - which it is for the case of aggressive, at least - then I see a possible avenue for implementing dynamic cheating.
The tricks: well, fixes have been proposed. I won't repeat them here, my point is to try to prove that however difficult something needs to be done. If I can't manage, well, I tried.
The summoning: surely the AIs use a rule right now, because there're retorts and number of books and difficulty levels that affect how much mana they have. Is the amount of mana completely ignored? I don't know how this works, so I can't really answer there.
> we have "early game tactics too powerful" and "late game tactics too weak" both listed as known problems we can't solve. Your suggestion escalates both of these problems by making early game offense work better and late game offense worse against the AI. So why are you so persistent about it?
Because then I don't think I've yet managed to communicate clearly what I am trying to do. Reduce early cheating = same garrisons, but less doomstacks, so no, there isn't any additional traction to "raze first 3 AI capitals before 1405 because fast races". Raise later cheating = reinforcing the late AI. So it's quite the contrary of what I've managed to transmit - way to go me, I'm supposed to communicate for a living lol.
Quote: it means reducing it somewhat at t40 but it can mean increasing it afterwards.
It's not the amount that's the problem, it's the DIRECTION. The suggested direction will escalate a known problem. So I'm not doing it because it will make things WORSE.
Your premise is wrong. You are basically saying "If the AI has less early advantage, we can play late game strategies without losing to it". And I'm saying "If the AI has less early advantage, early strategies beat it even more so late strategies will be obsolete, no one would play them."
But ok, let's look at some numbers.
(This is an example, not actual ingame numbers)
Turn 40, Currently.
AI has 40 total military power. Out of this 20 is garrison, 20 is free stacks to attack people with.
Human player playing late strategy has 10 - they are in trouble which is why you suggest what you do.
Human player playing early strategy has 80 - they can crush the AI and maintain enough defenses to not lose the game, but it'll cost them half their armies so they can only do one enemy wizard before the others get strong enough to have a chance to stop the invasion.
Turn 200, Currently.
AI has 5000 total military power.
Human late strategy has, ideally, 5000 to match it and result in an interesting game.
Human early strategy either already won or lost, so it's not relevant here.
Turn 40 your suggestion.
AI has only 20 military power. Probably all 20 garrison, maybe one or two weak stacks free.
Human playing late strategy has 10 - they are good to go. Your suggestion seems to fix this case.
Human player playing early strategy still has 80 - but this now enables them to crush all 3 other wizards on Arcanus. Maybe not all the fortresses, but as the AIs are now without free units, all the hamlets can be conquered, and that means eventually the fortresses fall to. By 1406-1408 Arcanus has only the human player.
Turn 200, your suggestion.
AI has 10000 military power. (We raised it.)
Human late strategy has 5000, this didn't change. So late strategies are now worse than before - they can't compete at the time they are meant to.
Human early strategy has ~15000 - they conquered the entire plane early so they hold 4 wizards worth of resources out of which a few cities are early races and don't contribute as much as the rest (otherwise it would be 20).
So it clearly makes early strategies win more and late game strategies win less, reducing the diversity of playable strategies and overall hurting the game.
Quote:If that's more than before - which it is for the case of aggressive, at least
Depends on your "before". Compared to 5.0, it's less. 5.0 left no intercontinental units in cities while 5.01 leaves the same amount it would from non-intercontinental. So if you mean this change, the direction is the opposite of what you refer to.
Compared to 4.x, it's about the same - aggressive keeps 1 fewer in cities but peaceful and maniacal keeps 1 more. But 4.x had larger AI bonus so if that's your base version for comparing then the AI bonus reduction has already been done.
Quote:The summoning: surely the AIs use a rule right now, because there're retorts and number of books and difficulty levels that affect how much mana they have. Is the amount of mana completely ignored? I don't know how this works, so I can't really answer there.
This is the "rule" :
Code:
.org 8E6h
;-----------------------------
; Categories
; [bp-60h] + 00 -MAGIC SPIRIT
; [bp-5Eh] + 01 -Summon
; [bp-5Ch] + 02 -Unit Buff
; [bp-5Ah] + 03 -City Buff
; [bp-58h] + 04 -DisenchantArea
; [bp-56h] + 05 -Disjunction
; [bp-54h] + 06 -Curse
; [bp-52h] + 07 -Wind walking /Floating Island / Wraith Form / Water Walking / Flight - use if not enough ships in this order of pref. -Only after turn 20!
; [bp-50h] + 08 -Hero (Summon Hero, Summon Champion, Incarnation, Resurrection) - do not pick if no hero slots!
; [bp-4Eh] + 09 -Spell Blast
; [bp-4Ch] + 10 -Dispelling Wave
; [bp-4Ah] + 11 -Items/Artifacts
; [bp-48h] + 12 -Spell of Mastery (Skip cost vs mana check!)
; [bp-46h] + 13 -Global Enchantment
; [bp-44h] + 14 -Stasis (cast on incoming doomstack)
; [bp-42h] + 15 -Lycanthropy (affect by Divine order as enchantment, high priority in early game, low later)
; [bp-40h] + 16 -Focus Magic
; [bp-3Eh] + 17 -Time Stop
; [bp-3Ch] + 18 -Magic Immunity
; [bp-3Ah] + 19 -Cheap Buff stacking - Don't do if Doom Mastery, Suppress Magic
; [bp-38h] + 20 -Invisibility (spam more Invisibility - only during Divine Order and war with the human player?)
; [bp-36h] + 21 -Final Wave
; [bp-34h] + 22 -Great Unsummoning
; [bp-32h] + 23 -Nature's Cures (NOT IMPLEMENTED - unsure - the AI probably has way too many damaged stacks at a time for this to be a good choice to use?)
; [bp-30h] + 24 -Summoning Circle
; [bp-2Eh] + 25 -Planar Travel
; [bp-2Ch] + 26 -Spell Lock
; [bp-2Ah] - 27 -Doomstack Participation (Wraith Form and Water Walking)
; [bp-28h] - 28
; [bp-26h] - 29
; [bp-24h] - 30
; [bp-22h] - 31
; [bp-20h] - 32
; [bp-1Eh] - 33
; [bp-1Ch] - 34
; [bp-1Ah] - 35
; [bp-18h] - 36
; [bp-16h] - 37
; [bp-14h] - 38
; [bp-12h] - 39
; [bp-10h] - 40
;
;
;
;-----------------------------
; [bp-A] - temp use
; [bp-8] - temp use
; [bp-6] - temp use
; [bp-4] -
; [bp-2] - intended slider amount
jmp start
setspellanddone:
push word ptr [bp-2] ;Slider Amount
push di ; Spell ID
push si ; Wizard ID
;call j_Cast_A_Spell
db 9Ah,2Fh,00,30h,04h
add sp, 6
pop di
pop si
mov sp, bp
pop bp
retf
loadtable:
push bx
xor bx,bx
nextclear:
mov word ptr [bx+0D386h],0
inc bx
inc bx
cmp bx,100
jl nextclear
pop bx
nextentry:
push bx
add bx,cx
add bx,cx
mov al,cs:[bx] ; Spell ID
xor ah,ah
push bx
push ax
call isknown
or ax,ax
pop ax
pop bx
jz zero
xor ah,ah
mov al,cs:[bx+1] ; Priority
jmp notzero
zero: ; Priority in AX, zero if spell unknown
xor ax,ax
notzero:
mov bx,cx
add bx,cx
mov word ptr [bx+0D388h],ax
pop bx
dec cx
cmp cx,0
jge nextentry
retn
addto:
cmp word ptr [bx],0
jz bad4144
add word ptr [bx],ax
bad4144:
retn
GlobalEnchantmentEffects:
; In : DX = Own wizard ID
push di
xor cx,cx
xor di,di
xor ax,ax
next:
push ax
push dx
mov ax,4C8h
imul di
mov bx,ax
pop dx
pop ax
SpellLockNeeded:
push di
xor di,di
lphewsl:
cmp di,[0BD92h]
jge doneewsl
loc_5A74Csl:
mov ax, di
mov bx,20h
imul bx
les bx, [9EC2h]
add bx, ax
test byte ptr es:[bx+19h],40h ; Already has Spell Lock
jnz nextewsl
mov al,es:[bx+3]
cmp al,[bp+6]
jnz nextewsl
; Own unit
xor cx,cx
mov ax, es:[bx+18h]
call countbuffs
mov ax, es:[bx+1Ah]
call countbuffs
cmp cx,4
jl nextewsl
add word ptr [bp-2Ch],5 ; 5 Spell Lock priority for unit with 4 spells
cmp cx,5
jl nextewsl
add word ptr [bp-2Ch],20 ; 25 Spell Lock priority for unit with 5 spells
cmp cx,8
jl nextewsl
add word ptr [bp-2Ch],200 ; 225 Spell Lock priority for unit with 8+ spells
nextewsl:
inc di
jmp lphewsl
doneewsl:
pop di
retn
countbuffs:
xor dx,dx
push cx
mov cx, 10h
loc_C1CAB:
test ax, 1
jz short loc_C1CB3
inc dx
loc_C1CB3:
shr ax, 1
loop loc_C1CAB
pop cx
add cx,dx
retn
UnsummonDecider:
push si
push di
xor di,di
xor si,si
loophead777:
cmp si,[0BD92h]
jge done777
mov ax, si
mov cl, 5
shl ax, cl
les bx, [9EC2h]
add bx, ax
push si
call DispellingWaveTarget
add sp,2
cmp dx,8
jl nodiwave
sub dx,6
shl dx,1
mov word ptr [bp-4Ch],dx ; 10 -Dispelling Wave
nodiwave:
;----------------------------
; 12 - Spell of Mastery
mov ax,0D5h
call isknown
or ax,ax
jz skipSOM
mov word ptr [bp-48h],500 ; Spell of Mastery known - priority 500
skipSOM:
; Do not cast spell of mastery if we have spell blast and need to stop another wizard with higher skill from casting it!
mov ax,si
call getwiz
cmp byte ptr [bx-5E99h], 2
jnz short locret_E423E
mov ax, [bx-60E0h]
mov cx, 4
imul cx
mov cx, 5
idiv cx
mov dx, ax
xor cx, cx
loc_E4217:
cmp cx, [bp+6]
jz short loc_E4237
push dx
mov ax, 4C8h
imul cx
mov bx, ax
pop dx
cmp byte ptr [bx-5DFEh], 2
jnz short loc_E4237
cmp dx, [bx-60E0h]
jge short loc_E4237
mov word ptr [bp-48h], 0
loc_E4237:
inc cx
cmp cx, [0BD9Ch] ;word_4283C
jl short loc_E4217
locret_E423E:
;----------------------------
; 04, 05 - Extra dispel power effects
mov ax,si
call getwiz
cmp byte ptr [bx-60C4h], 0
jz short loc_E41E7
; Runemaster
mov ax,3
imul word ptr [bp-56h]
mov word ptr [bp-56h],ax ; 3x Disjunction priority
sal word ptr [bp-58h],2 ; 4x Disenchant Area priority
sal word ptr [bp-4Ch],1 ; 2x Dispelling Wave
loc_E41E7:
cmp byte ptr [bx-5CB0h], 0
jz short loc_E41F4
; AEther Binding
sal word ptr [bp-56h],1 ; 2x Disjunction
sal word ptr [bp-58h],1 ; 2x Disenchant
sal word ptr [bp-4Ch],1 ; 2x Dispelling Wave
loc_E41F4:
;cmp byte ptr [bx-5E87h], 2
;jnz short loc_E41FE
; Known Spell Binding
;loc_E41FE:
cmp byte ptr [bx+0Ah],1 ; Medium priority
jnz rtrtrtr2
mov word ptr [bp-5Ch],100 ; + 02 -Unit Buff
rtrtrtr2:
cmp byte ptr [bx+1Dh],1 ; High priority
jnz rtrtrtr3
mov word ptr [bp-5Ch],166 ; + 02 -Unit Buff
rtrtrtr3:
;----------------------------
; 09 - Spell Blast
mov ax,3Ah
call isknown
or ax,ax
jz nospellblast
call SpellBlastNeeded
or ax,ax
jl nospellblast
mov word ptr [bp-4Eh],3000 ; If blast needed, very high priority to use it! 09 -Spell Blast
nospellblast:
;----------------------------
; 13 - Global Enchantment
mov word ptr [bp-46h], cx ; + 13 -Global Enchantment
mov ax,si
call getwiz
cmp word ptr [bx-5EDAh], 0C8h ; Don't do if low on mana
jge short loc_E4996
mov word ptr [bp-46h], 0
loc_E4996:
or cx,cx
jz skipggg
cmp word ptr [0BD90h],100
jge skipggg
mov word ptr [bp-46h], 1000 ; Have a global enchantment before turn 100? Use it ASAP, it's Just Cause or Aura of Majesty (or maybe AEther Binding/Divine Order)!
skipggg:
;---------------------------------------------------------------------
; 27 - Water Walking/Wraith Form to enable participation in doomstacks
; Past turn 200 only
cmp word ptr [0BD90h],200
jle nointercontinentalneed
; If AI doesn't know intercontinental very rare summon
xor cx,cx
mov ax,47h ; Djinn
call isknown
or cx,ax
mov ax,4Eh ; Sky Drake
call isknown
or cx,ax
mov ax,76h ; Great Drake
call isknown
or cx,ax
mov ax,6Ah ; Efreet
call isknown
or cx,ax
mov ax,6Bh ; Doom Bat
call isknown
or cx,ax
mov ax,9Fh ; Archangel
call isknown
or cx,ax
mov ax,0B8h ; Wraiths
call isknown
or cx,ax
mov ax,0C1h ; Death Knights
call isknown
or cx,ax
mov ax,0C8h ; Demon Lord
call isknown
or cx,ax
jnz nointercontinentalneed
mov ax,8 ; Water Walking
call isknown
or ax,ax
jnz yes771
mov ax,0A8h ; Wraith Form
call isknown
or ax,ax
jz nointercontinentalneed
yes771:
mov word ptr [bp-2Ah],100 ; fairly high priority - these are cheap spells and intercontinental units are vastly larger threat to the human player!
nointercontinentalneed:
mov bx,[9120h] ; Spell Categories Known
cmp byte ptr [bx+36h],1 ; Enchant/create
jnz plplpwggf
cmp word ptr [0BD90h],180 ; Don't before turn 180
jl plplpwggf
mov ax,si
call getwiz
mov word ptr [bp-4Ah],8
cmp byte ptr [bx-60C1h], 0
jz plplpwggf2
mov word ptr [bp-4Ah],20 ; One item for 5 creatures
plplpwggf2:
cmp word ptr [bx-60D6h],3 ;At least 3 LIFE books! If the AI can't heal the heroes, equipping them is a bad move!!!
jge asasaqq
sub word ptr [bp-4Ah],3 ; Less if not a life wizard.
asasaqq:
cmp word ptr [bx-60DAh],3 ;At least 3 Sorcery books! (Sorcery items are good. Also hero might be protected by Magic Immunity!)
jge asasaqq2
sub word ptr [bp-4Ah],3 ; Less if not a sorcery wizard.
asasaqq2:
plplpwggf:
;----------------------------
; 14 - Stasis
mov ax,44h
call isknown
or ax,ax
jz notdoom1
cmp word ptr [0BD96h],3 ; If difficulty Hard or lower, don't attempt to freeze enemy stacks - not enough overland skill discount, and also this is not a player friendly tactic.
jl notdoom1
mov ax,si
call getwiz
cmp word ptr [bx-60E0h],250 ; If skill<250, can't afford using Stasis every turn, would take up more than 25% skill per stack
jle notdoom1
mov di,si
mov si,44h
lea ax,[bp-0Ah]
push ax
lea ax,[bp-8]
push ax
lea ax,[bp-6] ; TargetunitID
push ax
push di
push cs
call StasisTarget
add sp,8
mov si,di
or ax,ax
jz notdoom1 ; No target found
mov ax,[bp-6]
mov cl,5
shl ax,cl
les bx,[9EC2h]
add bx,ax
; is it near the capital?
mov ax, si
mov cl, 2
shl ax, cl
les bx, [9CC8h] ;Fortress
add bx, ax
mov al,es:[bx]
sub al,dl
cmp al,0
jge tdtdtd
neg al
tdtdtd:
cmp al,7
jg notdoom1
mov ah,es:[bx+1]
sub ah,dh
cmp ah,0
jge tdtdtd2
neg ah
tdtdtd2:
cmp ah,7
jg notdoom1
; Stack is in a distance of 7 or less from the capital!
xor cx,cx
nextunit222:
push cx
mov cl,5
shl ax,cl
pop cx
les bx,[9EC2h]
add bx,ax
cmp es:[bx],dx
jnz notqqwe
cmp es:[bx+2],di
jnz notqqwe
; Unit is part of the targeted stack
mov al,es:[bx+5]
xor ah,ah
cmp ax,22h
jle doomstack
push dx
mov dx, 24h ; '$'
imul dx
pop dx
mov bx, ax
cmp word ptr [bx+1A6h],250 ; At least cost 250 units
jle notqqwe
doomstack:
inc word ptr [bp-6]
notqqwe:
inc cx
cmp cx,[0BD92h]
jl nextunit222
cmp word ptr [bp-6],5
jl notdoom1
; At least 5 units of high value (251+) or hero
; this is a doomstack!
; (disregard buffs - dispelling wave should solve that)
mov word ptr [bp-44h],10000 ; Must stop doomstack before it attacks!
notdoom1:
;----------------------------
; 15 - Lycanthropy
mov ax,0ADh
call isknown
or ax,ax
jz noli
mov word ptr [bp-42h], 5 ; Low priority in late game
cmp word ptr [0BD90h],120
jge noli
mov word ptr [bp-42h], 180 ; High priority in early game
noli:
cmp word ptr [bx-5EDAh], 1388h ; Not enough mana to use - requires at least 5000
jl notimestop
mov word ptr [bp-3Eh],1000 ; Can cast Time Stop? Do it! 17 -Time Stop
cmp word ptr [911Ah],0
jg notimestop
cmp word ptr [bx-5EDAh], 15000 ; But wait until 15000 if not planning to attack, is more economical
jge notimestop
mov word ptr [bp-3Eh],0 ; Waiting for more mana
notimestop:
cmp cx,4 ; Use additional cheap buff stacking tactic id and only if at least 4 of the above are known
jl dorrr
cmp word ptr [0BD90h],120 ; Don't before turn 120, these aren't cheap at all that early! (if no summon, buffs will automatically get used instead)
jl dorrr
mov word ptr [bp-3Ah],150 ; 1.5 buffs per summon
mov ax,36h
call isknown
or ax,ax
jnz notlock1
mov word ptr [bp-2Ch],0
notlock1:
;----------------------------
; 21 - Final Wave
mov ax,0C7h
call isknown
or ax,ax
jz notwave6
mov word ptr [bp-36h],60 ; 60 priority
notwave6:
;----------------------------
; 22 - Great unsummoning
mov ax,04Bh
call isknown
or ax,ax
jz notwave8
Call UnsummonDecider
cmp ax,5
jl notwave8
sal ax,1
mov word ptr [bp-34h],ax ; priority = 2x enemy fantastic units in play
notwave8:
;----------------------------
; 25 -Planar Travel
cmp word ptr [0BD90h],100 ; Not after turn 100
jge qoqoqoq
mov ax,8Ah
call isknown
or ax,ax
jz qoqoqoq ; Planer Travel must be known
mov ax,8Bh
call isknown
or ax,ax
jnz qoqoqoq ; Astral Gate must be unknown
mov word ptr [bp-2Eh],40
qoqoqoq:
;----------------------------
; 24 - Summoning Circle
;----------------------------
; More armies needed tactic - 01, 06
mov ax,si
call getwiz
cmp word ptr [bx-5C9Ch], 3 ; Main tactic - more armies needed
jnz ujuj
add word ptr [bp-5Eh],40 ; +40 Summons
mov ax,[bp-54h]
sar ax,2
add word ptr [bp-54h],ax ; +25% to curses
mov bx,[9120h] ; Spell Categories Known
cmp byte ptr [bx+2Ch],1 ; Military purpose city buffs (Cloud of Shadow, Altar of Battle, Spell Ward, etc)
jnz jojojo
add word ptr [bp-5Ah],30 ; +30 Military purpose city buffs
jojojo:
ujuj:
mov ax,si
call getwiz
cmp word ptr [bx-5C9Ch], 4 ; Main tactic - much armies needed
jnz ujuj2
add word ptr [bp-5Eh],100 ; +100 Summons
mov ax,[bp-54h]
sar ax,1
add word ptr [bp-54h],ax ; +50% to curses
jnz jojojo2
add word ptr [bp-5Ah],75 ; +75 Military purpose city buffs
jojojo2:
ujuj2:
; Divine Order in effect
mov ax,[bp-54h]
cwd
mov bx,3
idiv bx
add word ptr [bp-54h],ax ; +33% to Curses for each
sal word ptr [bp-42h],1 ; Double Lycanthropy - cheaper werewolves are great when summoning is more expensive. Still fairly low in late game unless 3+ divine orders!
mov ax,[bp-3Ah]
sar ax,1
add word ptr [bp-3Ah],ax ; Do 50% more "cheap buff stacking" tactic for each
add word ptr [bp-38h],50 ; Cast more Invisibility tactic
cmp word ptr [bp-5Ch],0
jz skip78282
add word ptr [bp-5Ch],40 ; +40 Unit buffs
skip78282:
cmp word ptr [bp-3Ch],0
jz skip782829
add word ptr [bp-3Ch],25 ; +25 Magic Immunity
skip782829:
cmp word ptr [bp-5Ah],0
jz skip78281
add word ptr [bp-5Ah],30 ; +30 City buffs
skip78281:
loc_E460D:
inc cx
cmp cx, 4
jle short loc_E45DF
;-----------------------------
;
cmp word ptr [-60DAh],4 ; Don't do invisibility spam tactic if human is sorcery (dispelling wave counters it too well!)
jge dont111
mov ax,si
call getwiz
cmp byte ptr [bx-5FDEh],1
jz dont111
cmp byte ptr [bx-5FDEh],2
jnz war111
dont111:
mov word ptr [bp-38h],0 ; Don't do invisibility spam tactic if pact or alliance with human!
war111:
mov ax,4Ah
call isknown
jz aawwwee
mov word ptr [bp-38h],0 ; Don't do invisibility spam tactic if mass invisibility is known!
aawwwee:
;-----------------------------------------------------------
; Spirit, priority 0 before turn 20 - no need for them yet
cmp word ptr [0BD90h],20
jg assqq
mov word ptr [bp-60h],0 ; Magic Spirit category - Do not use!
assqq:
;-----------------------------------------
; Suppress, Meteor, Wrath modifiers
mov dx,si
call GlobalEnchantmentEffects
; Out : CL = number of meteor storms in effect
; CH = Suppress Magics
; DL = Fairy Rings
; DH = Chaos Surges
or ch,ch
jz nosup111
; Suppress Magic in effect
mov word ptr [bp-60h],0 ; Magic Spirit category - Do not use!
mov word ptr [bp-52h],0 ; Intercontinental travel cateogory - Do not use (all low cost spells, except wind walking which is still only 250)
sar word ptr [bp-5Ch],1 ; Unit buffs halved - low chance of success
sar word ptr [bp-5Ah],1 ; City buffs halved - low chance of success
mov word ptr [bp-58h],0 ; Disenchant Area zero - cost 25 spell, wasteful, unlikely to succeed
sar word ptr [bp-4Eh],3 ; Spell Blast reduced - still try but don't go overboard.
sar word ptr [bp-4Ch],1 ; Dispelling Wave halved - low chance of success, but potential high damage, worth some try
mov word ptr [bp-44h],0 ; Stasis
mov word ptr [bp-42h],0 ; Lycanthropy
mov word ptr [bp-40h],0 ; Focus Magic
mov word ptr [bp-3Ah],0 ; Cheap Buff Stacking
mov word ptr [bp-38h],0 ; Invisibility
mov word ptr [bp-32h],0 ; Nature's Cures
mov word ptr [bp-30h],0 ; Summoning Circle
mov word ptr [bp-2Eh],0 ; Planar Travel
mov word ptr [bp-2Ch],0 ; Spell Lock
mov word ptr [bp-2Ah],0 ; Waterwalk/Wraith Form for doomstack
nosup111:
or dl,dl
jz nowrath13
;Fairy Ring in effect
;mov word ptr [bp-36h],0 ; Final Wave
;mov word ptr [bp-34h],0 ; Great Unsummoning
mov word ptr [bp-50h],0 ; Hero summoning (nonnature expensive spells, except basic Summon Hero which is obsolete by the time NW comes into play)
mov word ptr [bp-4Ah],0 ; Item creation
; Unsure about Time Stop, too powerful, probably worth it anyway!
nowrath13:
; Curse priority zero if no hostility!
cmp word ptr [911Ah],0
jg safecurse
mov word ptr [bp-54h],0 ; 06 -Curse
safecurse:
;Curse priority zero if no curses known!
mov bx,[9120h] ; Spell Categories Known
mov word ptr [bp-54h],0 ; 06 - Curse, zero if none known!
curseok9:
;self: jmp self
call pickcategory
;mov ax,si
;call getwiz
;mov word ptr [bx-60ECh], cx
;=====================================================
;=====================================================
; Spell from category
;=====================================================
;=====================================================
; In CX = category
; Out DI = spell
;---------------------------
; 1 - Summon category
;---------------------------
cmp cx,1
jnz ski2
jmp skiptable1
summontable:
db 006h,003 ; SLOT 0 - War Bears
db 009h,003 ; SLOT 1 - Sprites
db 00Eh,012 ; SLOT 2 - Giant Spiders
db 014h,020 ; SLOT 3 - Great Lizard
db 017h,032 ; SLOT 4 - Stone Giant
db 01Bh,050 ; SLOT 5 - Gorgons
db 020h,100 ; SLOT 6 - Behemoth
db 024h,150 ; SLOT 7 - Colossus
db 027h,150 ; SLOT 8 - Great Wyrm
db 037h,016 ; SLOT 9 - Water Elemental
db 041h,024 ; SLOT10 - Storm Giant
db 047h,075 ; SLOT11 - Djinn
db 04Eh,150 ; SLOT12 - Sky Drake
db 054h,002 ; SLOT13 - Hell Hound
db 05Fh,006 ; SLOT14 - Gargoyles
db 06Bh,050 ; SLOT15 - Doom Bat
db 067h,024 ; SLOT16 - Chaos Spawn
db 05Ch,012 ; SLOT17 - Fire Giant
db 064h,016 ; SLOT18 - Chimera
db 06Ah,040 ; SLOT19 - Efreet
db 06Fh,032 ; SLOT20 - Hydra
db 076h,150 ; SLOT21 - Great Drake
db 088h,010 ; SLOT22 - Unicorns
db 093h,024 ; SLOT23 - Angel
db 09Fh,090 ; SLOT24 - Archangel
db 000h,000 ; SLOT25
db 0A1h,001 ; SLOT26 - Skeleton
db 0A6h,004 ; SLOT27 - Ghouls
db 0B0h,012 ; SLOT28 - Night Stalker
db 031h,002 ; SLOT29 - Nagas
db 0B8h,032 ; SLOT30 - Wraiths
db 0B4h,024 ; SLOT31 - Shadow Demons
db 0C1h,064 ; SLOT32 - Death Knights
db 0C8h,200 ; SLOT33 - Demon Lord
db 000h,000 ; SLOT34
db 000h,000 ; SLOT35
db 000h,000 ; SLOT36
db 000h,000 ; SLOT37
db 000h,000 ; SLOT38
db 000h,000 ; SLOT39
db 000h,000 ; SLOT40
db 000h,000 ; SLOT41
db 011h,012 ; SLOT42 - Cockatrices
db 0BFh,032 ; SLOT43 - Summon Demon
skiptable1:
dosummon:
mov bx,summontable
mov cx,43
call loadtable
; If Death Knights, Wraiths = zero
mov ax,0C1h
call isknown
or ax,ax
jz skip555
mov word ptr [0D3C4h],0 ; Wraiths Priority zero
skip555:
mov dx,si
call GlobalEnchantmentEffects
; Out : CL = number of meteor storms in effect
; CH = Suppress Magics
; DL = Fairy Rings
; DH = Chaos Surges
cmp cl,0
jle nomoremeteor
mov word ptr [0D388h],0 ; War Bears
mov word ptr [0D3C2h],0 ; Nagas
mov word ptr [0D38Ah],0 ; Sprites
mov word ptr [0D38Ch],0 ; Giant Spiders
mov word ptr [0D3A2h],0 ; Hell Hounds
mov word ptr [0D3ACh],0 ; Chimeras
mov word ptr [0D3B4h],0 ; Unicorns
mov word ptr [0D3BCh],0 ; Skeletons
mov word ptr [0D3BEh],0 ; Ghouls
shr word ptr [0D3DCh],1 ; Halved cockatrices
nomoremeteor:
nextsurge:
cmp dh,0
jle nomoresurge
mov ax,40
mov bx,0D3A4h ; Gargoyles
call addto
mov al,50
mov bx,0D3ACh ; Chimeras
call addto
mov al,100
mov bx,0D3B0h ; Hydra
call addto
mov al,20
mov bx,0D3A2h ; Hell Hounds
call addto
mov ax,10
mov bx,0D3A6h ; Doom Bat
call addto
;mov ax,20
mov bx,0D3A8h ; Chaos Spawn
call addto
mov bx,0D3AAh ; Fire Giant
call addto
mov bx,0D3AEh ; Efreet
call addto
mov bx,0D3B2h ; Great Drake
call addto
dec dh
jmp nextsurge
nomoresurge:
cmp ch,0
jle nomoresuppress
mov word ptr [0D388h],0 ; War Bears
mov word ptr [0D3C2h],0 ; Nagas
mov word ptr [0D38Ah],0 ; Sprites
mov word ptr [0D38Ch],0 ; Giant Spiders
;mov word ptr [0D39Ah],0 ; Floating Island
mov word ptr [0D3A2h],0 ; Hell Hounds
mov word ptr [0D3A4h],0 ; Gargoyles
mov word ptr [0D3AAh],0 ; Fire Giants
mov word ptr [0D3BCh],0 ; Skeletons
mov word ptr [0D3BEh],0 ; Ghouls
;mov word ptr [0D3CEh],0 ; Magic Spirit
mov word ptr [0D3DCh],0 ; Cockatrices
shl word ptr [0D392h],1 ; Gorgons x2
shl word ptr [0D394h],1 ; Behemoth x2
shl word ptr [0D396h],2 ; Colossus x4
shl word ptr [0D398h],2 ; Wyrm x4
shl word ptr [0D39Eh],1 ; Djinn x2
shl word ptr [0D3A0h],2 ; Sky Drake x4
shl word ptr [0D3B0h],1 ; Hydra x2
shl word ptr [0D3B2h],2 ; Great Drake x4
shl word ptr [0D3B8h],2 ; Archangel x4
shl word ptr [0D3C4h],1 ; Wraiths x2
shl word ptr [0D3C8h],2 ; Death Knights x2
shl word ptr [0D3CAh],2 ; Demon Lord x4
nomoresuppress:
nextwrath:
cmp dl,0
jle nomorewrath
; Don't cast - these aren't worth letting the enemy get a free summon
;mov word ptr [0D3D8h],0 ; Summon Champion
;mov word ptr [0D3D2h],0 ; Enchant Item
;mov word ptr [0D3D4h],0 ; Create Artifact
; Reduced priority
sar word ptr [0D3A8h],2 ; Chaos Spawn
sar word ptr [0D3B6h],1 ; Angel
sar word ptr [0D3C4h],1 ; Wraiths
sar word ptr [0D39Ch],1 ; Storm Giant
sar word ptr [0D3AEh],1 ; Efreet
sar word ptr [0D3B0h],1 ; Hydra
; Doom Bats?
; Gorgons?
;sar word ptr [0D39Eh],1 ; Djinn
;sar word ptr [0D39Eh],1 ; Sky Drake
;sar word ptr [0D3B2h],1 ; Great Drake
;sar word ptr [0D3B8h],1 ; Archangel
;sar word ptr [0D3C8h],1 ; Death Knights
;sar word ptr [0D3CAh],1 ; Demon Lord
sar word ptr [0D3CCh],1 ; Resurrection
dec dl
jmp nextwrath
nomorewrath:
Call SelectASpell
cmp ax,0
jl failed533 ; -1 = failed to pick a spell
mov bx,ax
sal bx,1
mov al,cs:[bx+Summontable]
xor ah,ah
mov di,ax
cmp di,0
jg ssdone
failed533:
; Failed to pick a summoning spell!
; Do a Unit Buff instead
mov cx,2
ski2:
;---------------------------
; 2 - Unit Buff category
;---------------------------
cmp cx,2
jnz ski3
jmp skiptable2
bufftable:
db 002h,003 ; SLOT 0 - Resist Elements
db 02Fh,009 ; SLOT 1 - Focus Magic
db 015h,010 ; SLOT 2 - Elemental Armor
db 018h,030 ; SLOT 3 - Iron Skin
db 01Fh,050 ; SLOT 4 - Regeneration
db 029h,015 ; SLOT 5 - Resist Magic
db 000h,000 ; SLOT 6
db 000h,000 ; SLOT 7
db 045h,020 ; SLOT 8 - Magic Immunity
db 056h,009 ; SLOT 9 - Flame Blade
db 000h,000 ; SLOT10
db 063h,015 ; SLOT11 - Immolation
db 07Ch,006 ; SLOT12 - Holy Weapon
db 079h,010 ; SLOT13 - Bless
db 07Eh,015 ; SLOT14 - Holy Armor
db 082h,018 ; SLOT15 - Heroism
db 083h,005 ; SLOT16 - True Sight
db 08Fh,050 ; SLOT17 - Invulnerability
db 08Dh,050 ; SLOT18 - Lionheart
db 000h,000 ; SLOT19
db 0A4h,005 ; SLOT20 - Cloak of Fear
db 000h,000 ; SLOT21
db 0A8h,015 ; SLOT22 - Wraith Form
db 008h,015 ; SLOT23 - Water Walking
db 010h,012 ; SLOT24 - Land Linking
db 000h,000 ; SLOT25
db 038h,015 ; SLOT26 - Flight
db 03Fh,050 ; SLOT27 - Wind Walking
db 07Bh,015 ; SLOT28 - Endurance
db 000h,000 ; SLOT29
db 08Ah,010 ; SLOT30 - Planar Travel
db 000h,000 ; SLOT31
db 000h,000 ; SLOT32
db 036h,010 ; SLOT33 - Spell Lock
db 03Eh,040 ; SLOT34 - Invisibility
db 05Dh,015 ; SLOT35 - Chaos Channels
db 000h,000 ; SLOT36 (was Lycanthropy, separating)
db 0B3h,020 ; SLOT37 - Blood Lust
db 02Ch,010 ; SLOT38 - Guardian Wind
skiptable2:
mov bx,bufftable
mov cx,38
call loadtable
cmp [0BD90h],10
jge canfocus1
mov word ptr [0D38Ah],0
canfocus1:
mov ax, 4C8h
imul si
mov bx, ax
cmp byte ptr [bx-5CA1h], 0
jnz arms
cmp byte ptr [bx-5E39h], 2
jnz short loc_E5864
arms:
mov word ptr [0D3A0h],0 ; Holy Weapon zero if Holy Arms in effect or known
loc_E5864:
; Chaos Channels do not use during Doom Mastery
mov ax,si
call getwiz
cmp byte ptr [bx-5CA9h], 0
jz short loc_E5619
mov word ptr [0D3CEh],0
loc_E5619:
mov dx,si
call GlobalEnchantmentEffects
; Out : CL = number of meteor storms in effect
; CH = Suppress Magics
; DL = Fair Rings
; DH = Chaos Surges
;---------------------------
; 3 - City Buff Category
;---------------------------
cmp cx,3
jnz ski4
jmp skiptable3
citytable:
db 003h,005 ; SLOT 0 - Nature's Eye
db 012h,020 ; SLOT 1 - Transmute
db 00Fh,020 ; SLOT 2 - Change Terrain
db 000h,000 ; SLOT 3
db 03Dh,035 ; SLOT 4 - Uranus's Blessing
db 025h,100 ; SLOT 5 - Earth Gate
db 01Dh,050 ; SLOT 6 - Gaia's Blessing
db 046h,012 ; SLOT 7 - Flying Fortress
db 057h,012 ; SLOT 8 - Wall of Fire
db 080h,025 ; SLOT 9 - Heavenly Light
db 084h,030 ; SLOT10 - Stream of Life
db 090h,030 ; SLOT11 - Inspirations
db 091h,030 ; SLOT12 - Prosperity
db 08Bh,015 ; SLOT13 - Astral Gate
db 0BEh,045 ; SLOT14 - Dark Rituals
db 0B9h,025 ; SLOT15 - Cloud of Shadow
db 048h,050 ; SLOT16 - Spell Ward
db 09Bh,025 ; SLOT17 - Consecration
db 0B2h,012 ; SLOT18 - Wall of Darkness
db 092h,010 ; SLOT19 - Altar of Battle
skiptable3:
mov bx,citytable
mov cx,19
call loadtable
lea ax,[bp-6]
push ax
push si
push cs
call NatureEyetarget
pop cx
pop cx
or ax,ax
jnz okeye
mov word ptr [0D388h],0
okeye:
lea ax,[bp-0Ah]
push ax
lea ax,[bp-8]
push ax
lea ax,[bp-6]
push ax
push si
push cs
call Transmutetarget
pop cx
pop cx
pop cx
pop cx
or ax,ax
jnz oktrans
mov word ptr [0D38Ah],0
oktrans:
lea ax,[bp-0Ah]
push ax
lea ax,[bp-8]
push ax
lea ax,[bp-6]
push ax
push si
push cs
call CTtarget
pop cx
pop cx
pop cx
pop cx
or ax,ax
jnz okCT
mov word ptr [0D38Ch],0
okCT:
lea ax,[bp-6]
push ax
push si
push cs
call UranusTarget
pop cx
pop cx
or ax,ax
jnz okura
mov word ptr [0D390h],0
okura:
lea ax,[bp-6]
push ax
push si
push cs
call EarthGateTarget
pop cx
pop cx
or ax,ax
jnz okEG
mov word ptr [0D392h],0
okEG:
lea ax,[bp-6]
push ax
push si
push cs
call GaiaTarget
pop cx
pop cx
or ax,ax
jnz okGB
mov word ptr [0D394h],0
okGB:
lea ax,[bp-6]
push ax
push si
push cs
call FFTarget
pop cx
pop cx
or ax,ax
jnz okFF
mov word ptr [0D396h],0
okFF:
lea ax,[bp-6]
push ax
push si
push cs
call WoFTarget
pop cx
pop cx
or ax,ax
jnz okWoF
mov word ptr [0D398h],0
okWoF:
lea ax,[bp-6]
push ax
push si
push cs
call HeavenlyTarget
pop cx
pop cx
or ax,ax
jnz okHeav
mov word ptr [0D39Ah],0
okHeav:
lea ax,[bp-6]
push ax
push si
push cs
call StreamTarget
pop cx
pop cx
or ax,ax
jnz okSL
mov word ptr [0D39Ch],0
okSL:
lea ax,[bp-6]
push ax
push si
push cs
call InspirationTarget
pop cx
pop cx
or ax,ax
jnz okIns
mov word ptr [0D39Eh],0
okIns:
lea ax,[bp-6]
push ax
push si
push cs
call ProsperityTarget
pop cx
pop cx
or ax,ax
jnz okProsp
mov word ptr [0D3A0h],0
okProsp:
lea ax,[bp-6]
push ax
push si
push cs
call AstralTarget
pop cx
pop cx
or ax,ax
jnz okAstral
mov word ptr [0D3A2h],0
okAstral:
lea ax,[bp-6]
push ax
push si
push cs
call DarkRitualTarget
pop cx
pop cx
or ax,ax
jnz okDark
mov word ptr [0D3A4h],0
okDark:
lea ax,[bp-6]
push ax
push si
push cs
call CSTarget
pop cx
pop cx
or ax,ax
jnz okCS
mov word ptr [0D3A6h],0
okCS:
lea ax,[bp-8]
push ax
lea ax,[bp-6]
push ax
push si
push cs
call WardTarget
pop cx
pop cx
pop cx
or ax,ax
jnz okWard
mov word ptr [0D3A8h],0
okWard:
lea ax,[bp-6]
push ax
push si
push cs
call ConsTarget
pop cx
pop cx
or ax,ax
jnz okCons
mov word ptr [0D3AAh],0
okCons:
lea ax,[bp-6]
push ax
push si
push cs
call WoDTarget
pop cx
pop cx
or ax,ax
jnz okWoD
mov word ptr [0D3ACh],0
okWoD:
lea ax,[bp-6]
push ax
push si
push cs
call AltarTarget
pop cx
pop cx
or ax,ax
jnz okAltar
mov word ptr [0D3AEh],0
okAltar:
Call SelectASpell
cmp ax,0
jl TryAgain ; Failed to pick a city buff - pick another category!
mov bx,ax
sal bx,1
mov al,cs:[bx+Citytable]
xor ah,ah
mov di,ax
or di,di
jle TryAgain ; Failed to pick a city buff - pick another category!
jmp ssdone
ski4:
;---------------------------
; 4 - Disenchant Area Category
;---------------------------
cmp cx,4
jnz ski5
mov di,0CCh
mov word ptr [bp-2],25 ; Extra slider 25% - works best without extra slider
jmp ssdone
ski5:
cmp [bp-6],071h ; Against Meteor, Nature's Wrath, use 1200 (100% success)
jz need1200
; NW removed from the game
;cmp [bp-6],028h ; Against Meteor, Nature's Wrath, use 1200 (100% success)
;jz need1200
; There are dx wizards in the game.
; Chance to actually proceed with dispel is only 1/(2*number of wizards)
sal dx,1
call random
cmp ax,1
jnz TryAgain
mov word ptr [bp-2],50 ; Default, use 1125 strength disjunctions
cmp [bp-6],04Fh ; Against Supress use max
jz supress
;cmp [bp-6],87h ; Against Divine Order, Detect Magic use base 375 value
;jz minimaldis
;cmp [bp-6],0CEh ; Against Divine Order, Detect Magic use base 375 value
;jz minimaldis
;cmp [bp-6],07Fh ; Against Just Cause use base 375 value
;jz minimaldis
;cmp [bp-6],039h ; Against AEther Binding use 600
;jz aether
jmp ds2
;minimaldis:
;mov word ptr [bp-2],0
;jmp ds2
;aether:
;mov word ptr [bp-2],15
;jmp ds2
supress:
mov word ptr [bp-2],100
jmp ds2
need1200:
mov word ptr [bp-2],55
ds2:
mov ax,si
call getwiz
cmp byte ptr [bx-60C4h],0 ; Runemaster
jz uhuhu
sar cx,1 ; 2 times means 50% resistance
uhuhu:
cmp byte ptr [bx-5CB0h],0 ; AEther Binding
jz uhuhu2
sar cx,1 ; Doube strength means half power
uhuhu2:
mov ax,100
imul cx
mov cx,375 ; How many % of the base amount needed?
idiv cx
inc ax ; Round up
sub ax,100
or ax,ax
jge asdf
xor ax,ax ; Can't do less then 0% slider
asdf:
cmp ax,[bp-2]
jge ssdone
mov ax,[bp-2]
jmp ssdone ; If less is enough for 100% go with less
ski6:
;---------------------------
; 6 - Curse category
;---------------------------
cmp cx,6
jnz ski7
jmp skiptable4
Cursetable:
db 019h,003 ; SLOT 0 - Blizzard
db 01Ah,015 ; SLOT 1 - Earthquake
db 03Ah,010 ; SLOT 2 - Spell Blast
db 044h,008 ; SLOT 3 - Stasis
db 000h,000 ; SLOT 4
db 055h,008 ; SLOT 5 - Corruption
db 061h,015 ; SLOT 6 - Fire Storm
db 062h,025 ; SLOT 7 - Raise Volcano
db 000h,000 ; SLOT 8
db 06Eh,040 ; SLOT 9 - Chaos Rift
db 077h,200 ; SLOT10 - Call the Void
db 0BDh,030 ; SLOT11 - Famine
db 0BAh,025 ; SLOT12 - Warp Node
db 000h,000 ; SLOT13
db 0ABh,020 ; SLOT14 - Drain Power
db 0B7h,030 ; SLOT15 - Evil Presence
db 000h,000 ; SLOT16 (was Dispelling Wave, do not use randomly, always on-demand)
db 0C4h,060 ; SLOT17 - Pestilence
skiptable4:
mov bx,Cursetable
mov cx,17
call loadtable
; Earthquake
mov ax,si
call getwiz
cmp byte ptr [bx-5CACh], 0
jz noquake
push bx
mov bx,[9120h] ; Spell Categories Known
mov al, byte ptr [bx+4Ah] ; Best summon category known
add al, byte ptr [bx+4Eh] ; Second best summon category known
pop bx
cmp al,0
jz noquake ; Still cast EQ if no global summon to trigger SM.
mov word ptr [0D38Ah],0
noquake:
; Spell Blast, don't if human skill is low
cmp word ptr [-60E0h],200
jge oktoblast
mov word ptr [0D38Ch],0
oktoblast:
; No Raise Volcano during Armageddon!
mov ax,si
call getwiz
cmp byte ptr [bx-5CA6h], 0
jz nogeddon
mov word ptr [0D396h],0
nogeddon:
; Warp Node check for valid target
mov ax,0BAh
push ax
lea ax,[bp-6]
push ax
push cs
call WarpNodeTarget
pop cx
pop cx
or ax,ax
jnz validtarget1
mov word ptr [0D3A0h],0 ;Do not use if no valid target!
validtarget1:
; Evil Presense check for valid target
push si
mov ax,0B7h
push ax
lea ax,[bp-6]
push ax
push 6
push cs
call CityCurseTarget
add sp,8
or ax,ax
jnz validtarget2
mov word ptr [0D3A6h],0 ;Do not use if no valid target!
validtarget2:
; Famine check for valid target
push si
mov ax,0BDh
push ax
lea ax,[bp-6]
push ax
push 6
push cs
call CityCurseTarget
add sp,8
or ax,ax
jnz validtarget3
mov word ptr [0D39Eh],0 ;Do not use if no valid target!
validtarget3:
; Pestilence check for valid target
push si
mov ax,0C4h
push ax
lea ax,[bp-6]
push ax
push 6
push cs
call CityCurseTarget
add sp,8
or ax,ax
jnz validtarget4
mov word ptr [0D3AAh],0 ;Do not use if no valid target!
validtarget4:
; Rift check for valid target
push si
mov ax,06Eh
push ax
lea ax,[bp-6]
push ax
push 6
push cs
call CityCurseTarget
add sp,8
or ax,ax
jnz validtarget5
mov word ptr [0D39Ah],0 ;Do not use if no valid target!
validtarget5:
mov dx,si
call GlobalEnchantmentEffects
; Out : CL = number of meteor storms in effect
; CH = Suppress Magics
; DL = Fairy Rings
; DH = Chaos Surges
cmp ch,0
jle nomoresuppress4
mov word ptr [0D388h],0 ; Blizzard
mov word ptr [0D38Ch],0 ; Spell Blast
mov word ptr [0D38Eh],0 ; Stasis
mov word ptr [0D392h],0 ; Corruption
mov word ptr [0D396h],0 ; Raise Volcano
mov ax,100
mov bx,0D39Ch ; Call the void +100
call addto
;mov word ptr [0D3A2h],0 ; Black Wind
mov word ptr [0D3A4h],0 ; Drain Power
cmp cx,10
jnz ski11
mov di,034h
mov word ptr [bp-2],100 ; While works better with less slider, potential damage in one hit is higher with max 100%
jmp ssdone
ski11:
;--------------------------------------
; 11 - Create Artifact or Enchant Item
;--------------------------------------
cmp ax,10
jge csok
mov word ptr [0D39Ch],0 ; Do not use
jmp asdfg
csok:
imul word ptr [0D39Ch]
mov word ptr [0D39Ch],ax ; Priority = number of chaos units
asdfg:
push si
push cs
call DivineOrderValue
pop cx
cmp ax,10
jge divordok
mov word ptr [0D3B0h],0
jmp ujyhyh
divordok:
imul word ptr [0D3B0h]
mov word ptr [0D3B0h],ax ; Priority = 5* "Divine Order needed"
ujyhyh:
mov dx,si
call GlobalEnchantmentEffects
; Out : CL = number of meteor storms in effect
; CH = Suppress Magics
; DL = Fairy Rings
; DH = Chaos Surges
or ch,ch
jz nosup8
mov word ptr [0D3B4h],0 ; Suppress Magic in effect - Don't bother with Detect Magic (Spell Blast)
nosup8:
; If enchantment already cast, don't do it again!
mov ax,si
call getwiz
xor di,di
nextench:
cmp byte ptr [bx+di-5CB4h],0
jz rrrr
push di
sal di,1
mov word ptr [di+0D388h],0
pop di
rrrr:
inc di
cmp di,23
jle nextench
mov ax,3Ah
call isknown
or ax,ax
jnz ok336
mov word ptr [0D3B4h],0 ; Spell Blast unknown - don't do Detect Magic
ok336:
;----------------------------------------------------
; Check if can afford casting this spell?
;----------------------------------------------------
call getincome
mov ax, si
mov dx, 4C8h
imul dx
mov bx, ax
mov ax, [bx-5EDAh]
mov bx, 5
cwd
idiv bx
add ax, [bp-0Ah]
push ax
mov ax, di
mov dx, 24h ; '$'
imul dx
les bx, [912Ch] ; Spell_Data_Structure_Offset dword_3FBCC
add bx, ax
mov ax, es:[bx+1Ah]
mov bx, 0Ah
cwd
idiv bx
inc ax
inc ax
pop dx
cmp ax, dx
jle short loc_E3B3B
xor di,di ; Mana crystals/5+Mana income<Spell cost/10 then do not cast!
loc_E3B3B:
ssdone2:
jmp setspellanddone
.org 368Ah
EarthGateTarget:
.org 3720h
SpellBlastNeeded:
.org 392Ch
NatureEyeTarget:
.org 39ADh
Transmutetarget:
.org 3B2Ch
CTtarget:
.org 3D79h
FFTarget:
.org 3E39h
Uranustarget:
.org 3EBAh
Gaiatarget:
.org 3F3Bh
WoFTarget:
.org 3FBCh
WoDTarget:
.org 403Dh
HeavenlyTarget:
.org 40BEh
AltarTarget:
.org 413Fh
StreamTarget:
.org 41C0h
InspirationTarget:
.org 4241h
ProsperityTarget:
.org 42C2h
AstralTarget:
.org 4343h
DarkRitualTarget:
.org 43ECh
CSTarget:
.org 446Dh
Wardtarget:
.org 4711h
ConsTarget:
.org 4B49h
CityCurseTarget:
.org 56ABh
WarpNodeTarget:
.org 5773h
DisjunctionTarget:
.org 6284h
StasisTarget:
.org 66C2h
DispellingWaveTarget:
.org 7395h
DivineOrderValue:
The only mana related thing there is :
" Mana crystals/5+Mana income<Spell cost/10 then do not cast!"
meaning if the AI picked a spell, and it's too expensive to finish in a reasonable time, the AI won't cast that turn. But for something like a Naga (70) to trigger this, the AI would need less than 35 mana crystals with a zero income, or a negative income. It's mostly meant to prevent the AI from casting expensive spells like global enchantments when they still can't afford the cost but found it in treasure.