void Gameplay()
{
	Monsters(Squidgee, Grasslands, 1);
	Player.Attack();
	Player.Combat();
	Player.Movement();
}
Esempio n. 2
0
int main(int agrc, char **argv) {
    Character *police = new Police();

    police->setProperties("counter terrorist", 100, 50);
    police->getWeapon(new AK47("ak47", 100, 30));
    police->Attack();
    police->Defence();

    delete police;

    return 0;
}
int CreatureManager::Notify(int src,int tar,int messageID,int param)
{
	int result = -1;
	Character* target = GetCreature(tar);
	if (!target)
		result = eNotify_NoTarget;

	switch(messageID)
	{
	case eNotify_TowardToAttacker:
		result = target->TowardToAttacker(src);
		break;
	case eNotify_ReadyToBeAttacked:
		{
			//计算是否暴击   
			bool bCrit = false;
			if (g_RandomInt(0,9) < (int)(target->GetCrit()*10))
				bCrit = true;

			Character* _self = GetCreature(src);
			if(_self)
				CalculateHurt(target,_self,bCrit);

			if(!bCrit)
				target->Attack();
			else
				target->Crit();

			result = eNotify_Success;
			break;
		}
	case eNotify_FinishAttack:
		{
			target->SetFinish(true);
		}
		break;
	default:
		break;
	}

	return result;
}
Esempio n. 4
0
int CreatureManager::Notify(int src,int tar,int messageID,int param)
{
	int result = -1;
	Character* target = GetCreature(tar);
	if (!target)
		result = eNotify_NoTarget;

	switch(messageID)
	{
	case eNotify_TowardToAttacker:
		result = target->TowardToAttacker(src,param);
		break;
	case eNotify_ReadyToBeAttacked:
		{
			target->Attack();
			result = eNotify_Success;
		}
		break;
	default:
		break;
	}

	return result;
}