📄 fight.cpp
字号:
free(str);
_FREE(Role_Temp);
Role_Temp=Role_Move[j].ReadText("设置","continue");
}
else if(Command[j].lCommand == TOOLS)
{
char* str = FightRoleInit.ReadText(Hero[j]->Fight_Ini_Name,"Tool_Ini");
Role_Tool[j].Open(str);
free(str);
_FREE(Role_Temp);
Role_Temp=Role_Tool[j].ReadText("设置","continue");
}
else
{
_FREE(Role_Temp);
Role_Temp=Role_Magic[Command[j].lAccessory].ReadText("设置","continue");
sound_Magic.LoadSoundFX(hWnd,CMagic::MAGIC[Command[j].lAccessory].SoundFileName);
if(Command[j].Class==1) //对自己人的
{
if(Role_Magic[Command[j].lAccessory].ReadInt("设置","相对")) //根据魔法的对象决定魔法图片显示的初位置
{
fightmagic.x = Role_Magic[Command[j].lAccessory].ReadInt("设置","startx")+FightRole[j].x;
fightmagic.y = Role_Magic[Command[j].lAccessory].ReadInt("设置","starty")+FightRole[j].y;
}
else
{
fightmagic.x = Role_Magic[Command[j].lAccessory].ReadInt("设置","startx")+FightRole[Command[j].kill_who].x;
fightmagic.y = Role_Magic[Command[j].lAccessory].ReadInt("设置","starty")+FightRole[Command[j].kill_who].y;
}
}
else
{
if(Role_Magic[Command[j].lAccessory].ReadInt("设置","相对")) //根据魔法的对象决定魔法图片显示的初位置
{
fightmagic.x = Role_Magic[Command[j].lAccessory].ReadInt("设置","startx")+FightRole[j].x;
fightmagic.y = Role_Magic[Command[j].lAccessory].ReadInt("设置","starty")+FightRole[j].y;
}
else
{
fightmagic.x = Role_Magic[Command[j].lAccessory].ReadInt("设置","startx")+EnemyRole[Command[j].kill_who].x;
fightmagic.y = Role_Magic[Command[j].lAccessory].ReadInt("设置","starty")+EnemyRole[Command[j].kill_who].y;
}
}
}
kill_count=j; //切换到下一个主角
goto _MagicNext;
}
//没有下一个主角了就换敌人攻击
Enemy_AI();
main_count=ENEMY_KILL_ROLE;
m_nRoundCount ++; //增加回合计数
Account_Attack();
}
}
//不能使用的话,就保持常态
else
{
FightRole[kill_count].stop_temp = 1;
bShowMagicPic = false;
//不能使用的时候,显示提示
GameMessage.DoMenu(lpDDSBack, "魔法不足,不能使用");
for(int j=i+1; j<3; j++)
if(FightRole[j].use==1) // 用来判断下一个角色是哪个角色
{
if(Command[j].lCommand == ATTACK)
{
char* str = FightRoleInit.ReadText(Hero[j]->Fight_Ini_Name,"Move_Ini");
Role_Move[j].Open(str);
free(str);
_FREE(Role_Temp);
Role_Temp=Role_Move[j].ReadText("设置","continue");
}
else if(Command[j].lCommand == TOOLS)
{
char* str = FightRoleInit.ReadText(Hero[j]->Fight_Ini_Name,"Tool_Ini");
Role_Tool[j].Open(str);
free(str);
_FREE(Role_Temp);
Role_Temp=Role_Tool[j].ReadText("设置","continue");
}
else
{
_FREE(Role_Temp);
Role_Temp=Role_Magic[Command[j].lAccessory].ReadText("设置","continue");
sound_Magic.LoadSoundFX(hWnd,CMagic::MAGIC[Command[j].lAccessory].SoundFileName);
if(Command[j].Class==1) //对自己人的
{
if(Role_Magic[Command[j].lAccessory].ReadInt("设置","相对")) //根据魔法的对象决定魔法图片显示的初位置
{
fightmagic.x = Role_Magic[Command[j].lAccessory].ReadInt("设置","startx")+FightRole[j].x;
fightmagic.y = Role_Magic[Command[j].lAccessory].ReadInt("设置","starty")+FightRole[j].y;
}
else
{
fightmagic.x = Role_Magic[Command[j].lAccessory].ReadInt("设置","startx")+FightRole[Command[j].kill_who].x;
fightmagic.y = Role_Magic[Command[j].lAccessory].ReadInt("设置","starty")+FightRole[Command[j].kill_who].y;
}
}
else
{
if(Role_Magic[Command[j].lAccessory].ReadInt("设置","相对")) //根据魔法的对象决定魔法图片显示的初位置
{
fightmagic.x = Role_Magic[Command[j].lAccessory].ReadInt("设置","startx")+FightRole[j].x;
fightmagic.y = Role_Magic[Command[j].lAccessory].ReadInt("设置","starty")+FightRole[j].y;
}
else
{
fightmagic.x = Role_Magic[Command[j].lAccessory].ReadInt("设置","startx")+EnemyRole[Command[j].kill_who].x;
fightmagic.y = Role_Magic[Command[j].lAccessory].ReadInt("设置","starty")+EnemyRole[Command[j].kill_who].y;
}
}
}
kill_count=j;
goto _MagicNext;
}
//没有下一个主角了就换敌人攻击
Enemy_AI();
main_count=ENEMY_KILL_ROLE;
m_nRoundCount ++; //增加回合计数
Account_Attack();
}
}
else //对敌人的
{
if(Command[kill_count].kill_who!=Test_Enemy(Command[kill_count].kill_who)) // 测试要攻击的对象是否存在,如果不存在则换人
{
//重新计算
Command[kill_count].kill_who=Test_Enemy(Command[kill_count].kill_who);
Account_Attack();
if(Role_Magic[Command[kill_count].lAccessory].ReadInt("设置","相对"))
{
fightmagic.x = Role_Magic[Command[kill_count].lAccessory].ReadInt("设置","startx")+FightRole[kill_count].x;
fightmagic.y = Role_Magic[Command[kill_count].lAccessory].ReadInt("设置","starty")+FightRole[kill_count].y;
}
else
{
fightmagic.x = Role_Magic[Command[kill_count].lAccessory].ReadInt("设置","startx")+EnemyRole[Command[kill_count].kill_who].x;
fightmagic.y = Role_Magic[Command[kill_count].lAccessory].ReadInt("设置","starty")+EnemyRole[Command[kill_count].kill_who].y;
}
}
int temp = Command[kill_count].lAccessory;
//能够使用魔法
//m_fightmagic.IsCanUse(temp)
//显示图片
bShowMagicPic = true;
//进入使用状态
FightRole[kill_count].stop_temp=10;
Sleep(Role_Magic[temp].ReadInt("设置","延时"));
//读取人物位图的数据
RMove_Pic.left=Role_Magic[temp].ReadInt(Role_Temp,"left");
RMove_Pic.top=Role_Magic[temp].ReadInt(Role_Temp,"top");
RMove_Pic.right=Role_Magic[temp].ReadInt(Role_Temp,"right");
RMove_Pic.bottom=Role_Magic[temp].ReadInt(Role_Temp,"bottom");
//读取魔法效果图片的数据
fightmagic.RMagicPic.left = Role_Magic[temp].ReadInt(Role_Temp,"picleft");
fightmagic.RMagicPic.top = Role_Magic[temp].ReadInt(Role_Temp,"pictop");
fightmagic.RMagicPic.right=Role_Magic[temp].ReadInt(Role_Temp,"picright");
fightmagic.RMagicPic.bottom=Role_Magic[temp].ReadInt(Role_Temp,"picbottom");
//循环动作
//从开始攻击到敌人受伤到主角复位
if(Role_Magic[temp].ReadInt(Role_Temp,"对比")==1) //开始
{
//播放效果声音
char * soundtemp;
soundtemp=Role_Magic[temp].ReadText(Role_Temp,"SoundFileName");
if(soundtemp[0])
{
sound_Magic.Stop();
sound_Magic.LoadSoundFX(hWnd,soundtemp);
}
sound_Magic.Play();
//得到现在应该出现的位置
int rolex=Role_Magic[temp].ReadInt(Role_Temp,"x");
int roley=Role_Magic[temp].ReadInt(Role_Temp,"y");
if(Role_Magic[temp].ReadInt(Role_Temp,"人物相对"))
{
FightRole[kill_count].x1=FightRole[kill_count].x+rolex;
FightRole[kill_count].y1=FightRole[kill_count].y+roley;
}
else
{
FightRole[kill_count].x1=EnemyRole[Command[kill_count].kill_who].x+rolex;
FightRole[kill_count].y1=EnemyRole[Command[kill_count].kill_who].y+roley;
}
int picx = Role_Magic[temp].ReadInt(Role_Temp,"picx");
int picy = Role_Magic[temp].ReadInt(Role_Temp,"picy");
if(Role_Magic[temp].ReadInt(Role_Temp,"图片相对"))
{
fightmagic.x = FightRole[kill_count].x + picx;
fightmagic.y = FightRole[kill_count].y + picy;
}
else
{
fightmagic.x = EnemyRole[Command[kill_count].kill_who].x + picx;
fightmagic.y = EnemyRole[Command[kill_count].kill_who].y + picy;
}
char *str = Role_Temp;
//下一次的数据
Role_Temp=Role_Magic[temp].ReadText(Role_Temp,"continue");
free(str);
}
else if(Role_Magic[temp].ReadInt(Role_Temp,"对比")==2) //移动
{
int rolex=Role_Magic[temp].ReadInt(Role_Temp,"x");
int roley=Role_Magic[temp].ReadInt(Role_Temp,"y");
if(Role_Magic[temp].ReadInt(Role_Temp,"人物相对"))
{
FightRole[kill_count].x1=FightRole[kill_count].x+rolex;
FightRole[kill_count].y1=FightRole[kill_count].y+roley;
}
else
{
FightRole[kill_count].x1=EnemyRole[Command[kill_count].kill_who].x+rolex;
FightRole[kill_count].y1=EnemyRole[Command[kill_count].kill_who].y+roley;
}
int picx = Role_Magic[temp].ReadInt(Role_Temp,"picx");
int picy = Role_Magic[temp].ReadInt(Role_Temp,"picy");
if(Role_Magic[temp].ReadInt(Role_Temp,"图片相对"))
{
fightmagic.x = FightRole[kill_count].x + picx;
fightmagic.y = FightRole[kill_count].y + picy;
}
else
{
fightmagic.x = EnemyRole[Command[kill_count].kill_who].x + picx;
fightmagic.y = EnemyRole[Command[kill_count].kill_who].y + picy;
}
char *str = Role_Temp;
Role_Temp=Role_Magic[temp].ReadText(Role_Temp,"continue");
free(str);
}
else if(Role_Magic[temp].ReadInt(Role_Temp,"对比")==3) //敌人受伤
{
int rolex=Role_Magic[temp].ReadInt(Role_Temp,"x");
int roley=Role_Magic[temp].ReadInt(Role_Temp,"y");
if(Role_Magic[temp].ReadInt(Role_Temp,"人物相对"))
{
FightRole[kill_count].x1=FightRole[kill_count].x+rolex;
FightRole[kill_count].y1=FightRole[kill_count].y+roley;
}
else
{
FightRole[kill_count].x1=EnemyRole[Command[kill_count].kill_who].x+rolex;
FightRole[kill_count].y1=EnemyRole[Command[kill_count].kill_who].y+roley;
}
int picx = Role_Magic[temp].ReadInt(Role_Temp,"picx");
int picy = Role_Magic[temp].ReadInt(Role_Temp,"picy");
if(Role_Magic[temp].ReadInt(Role_Temp,"图片相对"))
{
fightmagic.x = FightRole[kill_count].x + picx;
fightmagic.y = FightRole[kill_count].y + picy;
}
else
{
fightmagic.x = EnemyRole[Command[kill_count].kill_who].x + picx;
fightmagic.y = EnemyRole[Command[kill_count].kill_who].y + picy;
}
char *str = Role_Temp;
Role_Temp=Role_Magic[temp].ReadText(Role_Temp,"continue");
free(str);
//敌人动作变成受伤的动作
EnemyRole[Command[kill_count].kill_who].stop_temp=11;
}
else if(Role_Magic[temp].ReadInt(Role_Temp,"对比")==4) //攻击
{
int rolex=Role_Magic[temp].ReadInt(Role_Temp,"x");
int roley=Role_Magic[temp].ReadInt(Role_Temp,"y");
if(Role_Magic[temp].ReadInt(Role_Temp,"人物相对"))
{
FightRole[kill_count].x1=FightRole[kill_count].x+rolex;
FightRole[kill_count].y1=FightRole[kill_count].y+roley;
}
else
{
FightRole[kill_count].x1=EnemyRole[Command[kill_count].kill_who].x+rolex;
FightRole[kill_count].y1=EnemyRole[Command[kill_count].kill_who].y+roley;
}
int picx = Role_Magic[temp].ReadInt(Role_Temp,"picx");
int picy = Role_Magic[temp].ReadInt(Role_Temp,"picy");
if(Role_Magic[temp].ReadInt(Role_Temp,"图片相对"))
{
fightmagic.x = FightRole[kill_count].x + picx;
fightmagic.y = FightRole[kill_count].y + picy;
}
else
{
fightmagic.x = EnemyRole[Command[kill_count].kill_who].x + picx;
fightmagic.y = EnemyRole[Command[kill_count].kill_who].y + picy;
}
char *str = Role_Temp;
Role_Temp=Role_Magic[temp].ReadText(Role_Temp,"continue");
free(str);
//敌人动作变成后退动作
EnemyRole[Command[kill_count].kill_who].stop_temp=10;
}
else if(Role_Magic[temp].ReadInt(Role_Temp,"对比")==5) //敌人惨叫
{
int rolex=Role_Magic[temp].ReadInt(Role_Temp,"x");
int roley=Role_Magic[temp].ReadInt(Role_Temp,"y");
if(Role_Magic[temp].ReadInt(Role_Temp,"人物相对"))
{
FightRole[kill_count].x1=FightRole[kill_count].x+rolex;
FightRole[kill_count].y1=FightRole[kill_count].y+roley;
}
else
{
FightRole[kill_count].x1=EnemyRole[Command[kill_count].kill_who].x+rolex;
FightRole[kill_count].y1=EnemyRole[Command[kill_count].kill_who].y+roley;
}
int picx = Role_Magic[temp].ReadInt(Role_Temp,"picx");
int picy = Role_Magic[temp].ReadInt(Role_Temp,"picy");
if(Role_Magic[temp].ReadInt(Role_Temp,"图片相对"))
{
fightmagic.x = FightRole[kill_count].x + picx;
fightmagic.y = FightRole[kill_count].y + picy;
}
else
{
fightmagic.x = EnemyRole[Command[kill_count].kill_who].x + picx;
fightmagic.y = EnemyRole[Command[kill_count].kill_who].y + picy;
}
char *str = Role_Temp;
Role_Temp=Role_Magic[temp].ReadText(Role_Temp,"continue");
free(str);
//产生魔法效果
//释放者少魔法值,承受者根据魔法决定
MagicEffect(temp, Hero[kill_count],&EnemyRole[Command[kill_count].kill_who],Command[kill_count].kill_who);
//敌人动作复位成受伤动作
//---------
//整个过程是
//敌人先被攻击
//然后后退
//然后复位到被攻击的动作
//-------------
EnemyRole[Command[kill_count].kill_who].stop_temp=11;
EnemyRole[Command[kill_count].kill_who].sound_Defend.Play(); //叫喊声
}
else
{
//主角回到原位置,不显示魔法图片
bShowMagicPic = false;
FightRole[kill_count].stop_temp=1;
//如果胜利了,就直接跳出进攻部分
if( Account_Loss()==1 )
goto _MagicNext;
//计算攻击力
Account_Attack();
//更新魔法槽数据
FightRole[kill_count].MagicLong=Hero[kill_count]->Mp * 100 / Hero[kill_count]->MaxMp;
//停止音乐
sound_Magic.Stop();
for(int j=i+1; j<3; j++)
if(FightRole[j].use==1) // 用来判断下一个角色是哪个角色
{
if(Command[j].lCommand == ATTACK)
{
char* str = FightRoleInit.ReadText(Hero[j]->Fight_Ini_Name,"Move_Ini");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -