Code:
char Check4DragonHeartArt(int Art)
{
_ECX(C4DHA_Hero);
__asm pusha
STARTNA(__LINE__, 0)
__asm{
push 159 //7
mov ecx,C4DHA_Hero
mov eax,0x4D9460
call eax
test al,al
je _DoesNotHave
}
_Hero_ *hp=(_Hero_ *)C4DHA_Hero;
Byte *cm;
__asm{
mov eax,0x699420
mov eax,[eax]
mov cm,eax
}
int tp=0;
if(Random(1,100)>90){ // random
tp=AnyDragon2Summon[Random(0,14)];
}else{ // terrain based
int mod=*(int *)&cm[0x53C0];
if(mod==-1){ // has modifier
if(mod<0 || mod>9) mod=0;
int chance=Random(0,100);
for(int i=0,j=0;i<20;i++){
if(Dragon2Summon[mod+10][i][1]==0) break;
tp=Dragon2Summon[mod+10][i][0];
j+=Dragon2Summon[mod+10][i][1];
if(chance<j) break;
}
}else{ // terrain based
_MapItem_ *mp=*(_MapItem_ **)&cm[0x53BC];
int mod=mp->Land;
if(mod<0 || mod>9) mod=9;
int chance=Random(0,100);
for(int i=0,j=0;i<20;i++){
if(Dragon2Summon[mod][i][1]==0) break;
tp=Dragon2Summon[mod][i][0];
j+=Dragon2Summon[mod][i][1];
if(chance<j) break;
}
}
}
int HPpoints=hp->ExpLevel*100;
int Hp0=MonTable[tp].HitPoints; if(Hp0<1) Hp0=1;
int num=HPpoints/Hp0; if(num<1) num=1;
// SummonCreatures3(tp,hp->PSkill[2],0/*level*/);
int side=-1;
if(*(_Hero_ **)&cm[0x53CC]==hp) side=0;
if(*(_Hero_ **)&cm[0x53D0]==hp) side=1;
if(side!=-1){
// if(side==0) pos=89; else pos=97;
// SammonCreatureEx(tp,num,pos,side,-1,1,0);
if(side==0){
do{
if(SammonCreatureIfPossible(tp,num, 89,side,-1,1,0)) break;
if(SammonCreatureIfPossible(tp,num, 55,side,-1,1,0)) break;
if(SammonCreatureIfPossible(tp,num,123,side,-1,1,0)) break;
if(SammonCreatureIfPossible(tp,num, 21,side,-1,1,0)) break;
if(SammonCreatureIfPossible(tp,num,157,side,-1,1,0)) break;
}while(0);
}else{
do{
if(SammonCreatureIfPossible(tp,num, 97,side,-1,1,0)) break;
if(SammonCreatureIfPossible(tp,num, 63,side,-1,1,0)) break;
if(SammonCreatureIfPossible(tp,num,131,side,-1,1,0)) break;
if(SammonCreatureIfPossible(tp,num, 29,side,-1,1,0)) break;
if(SammonCreatureIfPossible(tp,num,165,side,-1,1,0)) break;
}while(0);
}
}
_DoesNotHave:
STOP
__asm popa
__asm{
mov eax,Art
mov ecx,C4DHA_Hero
push eax
mov eax,0x4D9460
call eax
mov CDummy,al
}
return CDummy;
}