- Code: Select all
void cpu_marioRandomAttacks(char type[50], int power)
{
if(type="projectile")
{
cpu_marioB();
}
if(type="melee")
{
double random=300;
switch(power)
{
case 0:
//just punches
cpu_marioA();
break;
case 1:
//low power
if((random>=0)&&(random<150))
{
cpu_marioA();
}
if((random>=150)&&(random<250))
{
cpu_marioSideA();
}
if((random>=250)&&(random<270))
{
cpu_marioDownA();
}
if((random>=270)&&(random<275))
{
cpu_marioSideB();
}
if((random>=275)&&(random<279))
{
cpu_marioB();
}
if((random>=279)&&(random<282))
{
cpu_marioSideSmash();
}
if((random>=282)&&(random<285))
{
cpu_marioDownSmash();
}
if((random>=285)&&(random<288))
{
cpu_marioUpSmash();
}
if(random>=288)
{
cpu_marioA();
}
break;
case 2:
//average shuffling
if((random>=0)&&(random<120))
{
cpu_marioA();
}
if((random>=120)&&(random<200))
{
cpu_marioSideA();
}
if((random>=200)&&(random<260))
{
cpu_marioDownA();
}
if((random>=260)&&(random<210))
{
cpu_marioSideB();
}
if((random>=210)&&(random<240))
{
cpu_marioUpB();
}
if((random>=240)&&(random<260))
{
cpu_marioB();
}
if((random>=260)&&(random<270))
{
cpu_marioSideSmash();
}
if((random>=270)&&(random<280))
{
cpu_marioDownSmash();
}
if((random>=280)&&(random<295))
{
cpu_marioUpSmash();
}
if(random>=295)
{
cpu_marioA();
}
break;
case 3:
//high power
if((random>=0)&&(random<50))
{
cpu_marioA();
}
if((random>=50)&&(random<95))
{
cpu_marioSideA();
}
if((random>=95)&&(random<130))
{
cpu_marioDownA();
}
if((random>=130)&&(random<150))
{
cpu_marioSideB();
}
if((random>=150)&&(random<210))
{
cpu_marioUpB();
}
if((random>=210)&&(random<230))
{
cpu_marioB();
}
if((random>=230)&&(random<255))
{
cpu_marioSideSmash();
}
if((random>=255)&&(random<280))
{
cpu_marioDownSmash();
}
if(random>=280)
{
cpu_marioUpSmash();
}
break;
}
}
if(type="upAttack")
{
double random=rand(300);
switch(power)
{
case 0:
//constant standard up attack
cpu_marioUpA();
break;
case 1:
//low power
if((random>=0)&&(random<250))
{
cpu_marioUpA();
}
if(random>=250)
{
cpu_marioUpSmash();
}
break;
case 2:
//average shuffling
if((random>=0)&&(random<100))
{
cpu_marioUpA();
}
if((random>=100)&&(random<200))
{
cpu_marioUpB();
}
if(random>=200)
{
cpu_marioUpSmash();
}
break;
case 3:
//high power
if((random>=0)&&(random<50))
{
cpu_marioUpA();
}
if((random>=50)&&(random<150))
{
cpu_marioUpB();
}
if(random>=150)
{
cpu_marioUpSmash();
}
break;
}
}
if(type="standardAttack")
{
double random=rand(400);
switch(power)
{
case 0:
//normal and side
if(random<200)
{
cpu_marioA();
}
if(random>=200)
{
cpu_marioSideA();
}
break;
case 1:
//low power
if((random>=0)&&(random<200))
{
cpu_marioA();
}
if((random>=200)&&(random<300))
{
cpu_marioSideA();
}
if((random>=300)&&(random<365))
{
cpu_marioDownA();
}
if(random>=365)
{
cpu_marioUpA();
}
break;
case 2:
//average shuffling
if((random>=0)&&(random<150))
{
cpu_marioA();
}
if((random>=150)&&(random<250))
{
cpu_marioSideA();
}
if((random>=250)&&(random<335))
{
cpu_marioDownA();
}
if(random>=335)
{
cpu_marioUpA();
}
break;
case 3:
//high power
if((random>=0)&&(random<100))
{
cpu_marioA();
}
if((random>=100)&&(random<220))
{
cpu_marioSideA();
}
if((random>=220)&&(random<340))
{
cpu_marioDownA();
}
if(random>=340)
{
cpu_marioUpA();
}
break;
}
}
if(type="downAttack")
{
double random=rand(200);
switch(power)
{
case 0:
cpu_marioDownA();
break;
case 1:
//low power
if(random<160)
{
cpu_marioDownA();
}
if(random>=160)
{
switch(onGround)
{
case 0:
cpu_marioSideA();
break;
case 1:
cpu_marioDownSmash();
break;
}
}
break;
case 2:
//average shuffling
if(random<120)
{
cpu_marioDownA();
}
if(random>=120)
{
switch(onGround)
{
case 0:
cpu_marioSideA();
break;
case 1:
cpu_marioDownSmash();
break;
}
}
break;
case 3:
//high power
if(random<80)
{
cpu_marioDownA();
}
if(random>=80)
{
switch(onGround)
{
case 0:
cpu_marioSideA();
break;
case 1:
cpu_marioDownSmash();
break;
}
}
break;
}
}
if(type="defensive")
{
cpu_marioSideB();
}
if(type="upMove")
{
cpu_marioUpB();
}
}