
Game
Source Code
lvpengms
1

/****************************************************
* Define.H
*************************************************/
#include<iostream>
#include<list>
#include<string>
#include<cmath>
#include<vector>
#include<fstream>
#include<ctime>
#include<windows.h>
using namespace std;
class Role;
class Monster;
class MonsterList;
class Mission;
class MissionList;
class Skill;
class SkillList;
class Using;
class UsingList;
class Weapon;
class WeaponList;
class NPC;
class NPCList;
class Map;
class MapList;
#define SLEEPTIME 900
extern void ext_print_line();
/
************************************************************
******
* USE.H
* This class is the using class in game, and at the end
of
* this file ,I add another class: UsingList, it will
manage
* the all-using-thing in game when initilized,and it have
every
* using-thing.
*
* lvpengms 2009-08-28
************************************************************
*****/
2

#include"define.h"
#define PERCENT 1 /* percentOrNot is 1;*/
#define NOPERCENT 0 /* percentOrNot is 0*/
/*
* this class stand for the using thing of role in game,
* the using add hp,mp
* and also include special-mission-using thing ,every
* thing that can be used in game has its only ID,so we
* can get it through the ID
*/
class Using{
private:
/*
* the ID in this game is only!
* you can find it through ID of it!
*/
int ID;
/* every thing has a name!*/
string name;
/* and the money of it */
int money;
/*
* this var mean the number of it in role's beg
* when role pick up a same id of using ,then the using
* in role's beg must add 1,when its number is 0, role's
* beg must delete it!
* the number in the UsingList is always 1.
*/
int number;
/*
* those two var means the point role add;
*/
int addHitPoint;
int addManaPoint;
/*
* percent-or-not :
* 1: then add -hit-point and add-mana-point is the
* percent,for exsample add-hit-point 40 means
* role recover 40% of his max-role-hit-point.
* 0: mean role recover add-hit-point of hp
*/
int percentOrNot;
public:
/*
* this part functions mean to get the information of
using
* other class member function can use it !
3

*/
int GetID();
string GetName();
int GetNumber();
int GetPercentOrNot();
int GetAddHitPoint();
int GetAddManaPoint();
int GetMoney();
/*
* and this part means to set the information of using
* the functions will be used in the begin of
game :init();
*/
int SetName(string);
int SetID(int);
int SetNumber(int);
int SetPercentOrNot(int);
int SetAddHitPoint(int);
int SetMoney(int);
int SetAddManaPoint(int);
/*
* this function will be used when role pick up a using
* or use a using
* And those two function will be overload because role
may
* throw part of them or get part of them.
*
*/
int AddNumber(int);
int AddNumber(int&,int);
int DecreaseNumber(int );
int DecreaseNumber(int&,int);
/*
* this part will print the information of using when in
* the game,
* PrintLessInfo() will worked when print the list of beg
of using
* PrintInfo() will worked when role select ot check up
the information
* of using
*/
int PrintLessInfo();
/*
* this function return three sorts of value:
* 1:the role decide to use it
* 0:the role do nothing about it
4

* -1:the role decide to thow out the using
* the var in_npc_or_not mean if it show in shop.
* if in shop ,we should show throw/use.
*/
int PrintInfo(int in_npc_or_not = 0);
/*is the using-thing used up? this function will give you
an answer*/
bool UseUp();
};
/*
* this class conclude whole using thing in the game ,and
the same as
* weaponlist.
*/
class UsingList
{
private:
/*
* this list is the only in game ,and every using-thing
in this list is
* unique.
*/
list<Using> usingList;
list<Using>::iterator itr_using;
public:
/*
* this function will return a using according to the id
of using thing
*/
Using GetUsing(const int& );
/*
* will push a using-thing in list,if the param has been
in the usinglist
* the function will return a value of 0,
* if it has been succeed push_back(), the function will
return 1.
*/
int PushUsing(Using );
/* return a value that the total number of using in this
game.
* this function maybe not used.
*/
int GetSize();
/*
* those sevral functions will be used when need to get
some using
*/
5
- 1
- 2
- 3
- 4
前往页