示例#1
0
void UpdateRollAway( float elapsedTime, CSkill* skill, CParticleSystem* ps )
{
	CPlayer* pPlayer		= CPlayer::GetInstance();
	CBattleMap* pBattleMap	= CBattleMap::GetInstance();
	CBase* character		= pBattleMap->GetCurrChar();
	CBase* target			= pBattleMap->GetCurrEnemyTarget();
	//	if the skill consists of more than one animation, this needs to happen when each one is finished
	if (skill->Trigger()) 
	{
		ps[NINJA_BLOOD].Emit(target->GetPosX(), target->GetPosY());
		ps[NINJA_BLOOD].m_bActive = true; ps[NINJA_BLOOD].m_bLoop = false;

		// FORMULA: str - def + dmg + accuracy * 1.5 + random(-5 to 5) + (QTE amt successful * 5)
		skill->DmgToRender( (int)((float)(character->GetStrength() - target->GetDefense() + 
			skill->GetDmg() + character->GetAccuracy()) * 1.5f + rand() % (5 + 4) - 5) + (skill->GetCurrAmtSuccessful() * 5) );
		target->SetHealth(target->GetHealth() - skill->DmgToRender());
		ps[NINJA_BLOOD].m_bActive = false;
		skill->Trigger(false);
	}
	/*ps[BLOOD].UpdateParticle(elapsedTime);
	ps[BLOOD].DrawParticle(CAssets::GetInstance()->aBloodParticle);*/
}
示例#2
0
CBase* Factory::CreateWeapon(int type, POINT mapPoint, bool bAddtoMngr)
{
	CBase* weapon = new CBase();

	CBase* temp;
	
	switch(type)
	{
	case BOKKEN:
		temp = weapons[BOKKEN];
		temp->SetName("Bokken");
		temp->SetImageID(CAssets::GetInstance()->aSwordID);
		temp->SetNumType(0);
		break;
	case TACHI:
		temp = weapons[TACHI];
		temp->SetName("Tachi");
		temp->SetImageID(CAssets::GetInstance()->aSwordID);
		temp->SetNumType(1);

		break;
	case KATANA:
		temp = weapons[KATANA];
		temp->SetName("Katana");
		temp->SetImageID(CAssets::GetInstance()->aSwordID);
		temp->SetNumType(2);

		break;
	case NINJATO:
		temp = weapons[NINJATO];
		temp->SetName("Ninjato");
		temp->SetImageID(CAssets::GetInstance()->aSwordID);
		temp->SetNumType(3);

		break;
	case WOODNUN:
		temp = weapons[WOODNUN];
		temp->SetName("Wooden Nunchaku");
		temp->SetImageID(CAssets::GetInstance()->aNunchakuID);
		temp->SetNumType(4);

		break;
	case GLASSNUN:
		temp = weapons[GLASSNUN];
		temp->SetName("Glass Nunchaku");
		temp->SetImageID(CAssets::GetInstance()->aNunchakuID);
		temp->SetNumType(5);

		break;
	case STEELNUN:
		temp = weapons[STEELNUN];
		temp->SetName("Steel Nunchaku");
		temp->SetImageID(CAssets::GetInstance()->aNunchakuID);
		temp->SetNumType(6);

		break;
	case OAKSTAFF:
		temp = weapons[OAKSTAFF];
		temp->SetName("Oak Bo Staff");
		temp->SetImageID(CAssets::GetInstance()->aStaffID);
		temp->SetNumType(7);

		break;
	case BAMBOOSTAFF:
		temp = weapons[BAMBOOSTAFF];
		temp->SetName("Bamboo Staff");
		temp->SetImageID(CAssets::GetInstance()->aStaffID);
		temp->SetNumType(8);

		break;
	case STEELSTAFF:
		temp = weapons[STEELSTAFF];
		temp->SetName("Steel Staff");
		temp->SetImageID(CAssets::GetInstance()->aStaffID);
		temp->SetNumType(9);

		break;
	case RUSTYSAI:
		temp = weapons[RUSTYSAI];
		temp->SetName("Rusty Sais");
		temp->SetImageID(CAssets::GetInstance()->aSaiID);
		temp->SetNumType(10);

		break;
	case POLISHEDSAI:
		temp = weapons[POLISHEDSAI];
		temp->SetName("Polished Sais");
		temp->SetImageID(CAssets::GetInstance()->aSaiID);
		temp->SetNumType(11);

		break;
	}
	weapon->SetWeapon(temp->GetName(),temp->GetStrength(), temp->GetDefense(), temp->GetImageID(), temp->GetNumType());

	weapon->SetType(OBJECT_WEAPON);
	weapon->SetWidth(32);
	weapon->SetHeight(32);

	if (bAddtoMngr)
	{
		CBattleMap* pBM =  CBattleMap::GetInstance();
		weapon->SetCurrTile(mapPoint, pBM->GetOffsetX(),pBM->GetOffsetY(),pBM->GetTileWidth(), pBM->GetTileHeight(),pBM->GetNumCols(),false);
	
		ObjectManager::GetInstance()->Add(weapon);
	}

	return weapon;
}