91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

采用c++面向對象的思想設計的格斗類游戲,包括玩家類,繼承自玩家類的弓箭手、法師和戰士類,以及存放人物道具的背包類。

資源截圖

代碼片段和文件信息

//=======================
// archer.cpp
//=======================
#include?“archer.h“
Archer::Archer(int?lv_in?string?name_in)
{
role?=?ar; //?enumerate?type?of?job
LV?=?lv_in;
name?=?name_in;

//?Initialising?the?character‘s?properties?based?on?his?level
HPmax?=?150?+?6?*?(LV?-?1); //?HP?increases?6?point2?per?level
HP?=?HPmax;
MPmax?=?75?+?2?*?(LV?-?1); //?MP?increases?2?points?per?level
MP?=?MPmax;
AP?=?25?+?8?*?(LV?-?1); //?AP?increases?8?points?per?level
DP?=?25?+?2?*?(LV?-?1); //?DP?increases?2?points?per?level
speed?=?25?+?2?*?(LV?-?1); //?speed?increases?2?points?per?level

playerdeath?=?0;
EXP?=?LV*LV?*?75;
bag.set(lv_in?lv_in);
}

void?Archer::isLevelUp()
{
if?(EXP?>=?LV*LV?*?75)
{
LV++;
AP?+=?8;
DP?+=?2;
HPmax?+=?6;
MPmax?+=?2;
speed?+=?2;
cout?< cout?< cout?< cout?< cout?< cout?< system(“pause“);
isLevelUp(); //?recursively?call?this?function?so?the?character?can?level?up?multiple?times?if?got?enough?exp
}
}

bool?Archer::attack(player?&p)
{
double?HPtemp?=?0; //?opponent‘s?HP?decrement
double?EXPtemp?=?0; //?player?obtained?exp
double?hit?=?1.2; //?attach?factor?probably?give?critical?attack
srand((unsigned)time(NULL)); //?generating?random?seed?based?on?system?time

//?If?speed?greater?than?opponent?you?have?some?possibility?to?do?double?attack
if?((speed?>?p.speed)?&&?(rand()?%?100? {
HPtemp?=?(int)((1.0*AP?/?p.DP)*AP?*?5?/?(rand()?%?4?+?10)); //?opponent‘s?HP?decrement?calculated?based?their?AP/DP?and?uncertain?chance
cout?< p.HP?=?int(p.HP?-?HPtemp);
EXPtemp?=?(int)(HPtemp*1.2);
}

//?If?speed?smaller?than?opponent?the?opponent?has?possibility?to?evade
if?((speed? {
cout?< system(“pause“);
return?1;
}

//?10%?chance?give?critical?attack
if?(rand()?%?100?<=?10)
{
hit?=?1.7;
cout?< }

//?Normal?attack
HPtemp?=?(int)((1.0*AP?/?p.DP)*AP?*?5?/?(rand()?%?4?+?10));
cout?< EXPtemp?=?(int)(EXPtemp?+?HPtemp*1.2);
p.HP?=?(int)(p.HP?-?HPtemp);
cout?< EXP?=?(int)(EXP?+?EXPtemp);
system(“pause“);
return?1; //?Attack?success
}

bool?Archer::specialatt(player?&p)
{
if?(MP? {
cout?< system(“pause“);
re

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????4586??2018-04-13?21:42??archer.cpp
?????文件?????????646??2018-04-13?22:07??archer.h
?????文件?????????844??2011-04-14?08:46??container.cpp
?????文件?????????682??2011-04-14?08:40??container.h
?????文件????????4619??2018-04-13?21:29??mage.cpp
?????文件?????????616??2018-04-13?22:57??mage.h
?????文件????????2973??2011-04-14?08:47??main.cpp
?????文件????????3319??2011-04-14?08:46??player.cpp
?????文件????????1861??2011-04-14?08:42??player.h
?????文件????????4311??2011-04-14?08:45??swordsman.cpp
?????文件?????????647??2011-04-14?08:46??swordsman.h

評論

共有 條評論