Ejemplo n.º 1
0
//UPDATE() FUNCTION//////////////////////////////////////////////////////////////////////////////////////////////////////
//updates the player information
void Player::Update(void)
{	
	//update health and health display
	HealthDisplay();
	if(health<750 && health>0)
	{
		health++;
	}
	if(health<=0)
	{
		Death();
	}
	
	//update position of throwing star if it is active
	if(throw_time>0)
	{
		Star.Move();         //move and rotate star for set time
		Star.Rotate(15);
		throw_time--;
	}
	else
	{
		Star.MoveTo(-10, -10);
		Star.SetVelocity(0, 0);
	}
}
Ejemplo n.º 2
0
void Character::All(){
	Draw();
	if( life > 0 ){
		Move();
		Shot();
	}
	Death();
	
}
Ejemplo n.º 3
0
void Unit::Hitted(int damage)
{
    if (m_IsDeath)
        return;

    m_HitRenderFlag = true;
    m_CurHp -= damage;
    if (m_CurHp <= 0)
    {
        m_CurHp = 0;
        Death();
    }
}
Ejemplo n.º 4
0
void Character::DamageHealth(int& damage, Cell* Room[20][20])
{
	int newHealth = *m_Health - damage;
	if(newHealth > 0)
	{
		SetHealth(newHealth);
		m_isDead = false;
	}
	else	//Death
	{
		Death(Room);
	}
}
Ejemplo n.º 5
0
void TClient::ReSpawn(bool newConnected) {

    if (PlayerStatus == PS_Dead || newConnected) {
        ETeam NewTeam = Server()->AutoBalance();
        if (NewTeam != T_Neutral) {
            Team = NewTeam;
        }
        emit SpawnPlayer(Id, Team);
        TPlayer* player = Server()->Application()->GetWorld()->GetPlayer(Id);
        player->SetNickname(NickName);
        connect(this, SIGNAL(ControlReceived(Epsilon5::Control)),
                player, SLOT(ApplyControl(Epsilon5::Control)));
        connect(player, SIGNAL(Death(size_t)),
                this, SLOT(Kill()));
        PlayerStatus = PS_Spawned;
        ((TApplication*)qApp)->GetServer()->NeedFullPacket();
    }
}
Ejemplo n.º 6
0
GameState::GameState():
loop(true),
outcome(IN_PROGRESS),
gameOverTimer(0),

vampire(Location(1000, 1000)),

currPersonList(&personList1),

heartbeat(SOUND_PATH + "beat1.wav"),
offset(0, 0),
closestPerson(0),
heartTimer(rand()%200 + 900),

map(offset),

ahBreathSound(SOUND_PATH + "Ahhhh Breath.wav"),
deathBonesSound(SOUND_PATH + "DeathBones.wav"),
deathBonesScreamSound(SOUND_PATH + "DeathBonesScream.wav"),
deathScream(SOUND_PATH + "DeathScream.wav"),
evilSound(SOUND_PATH + "EVIL.WAV"),
miss1Sound(SOUND_PATH + "Miss.wav"),
miss2Sound(SOUND_PATH + "Miss2.wav"),
//slashSound(SOUND_PATH + "Slash_Sound_Effects_and_Music_006220237_prev.mp3"),

hunter(0),

environment(vampire.getBloodPercent()),

shakingTime(0),
shakingMagnitude(0){

    Person::state = this;
    AOEAttack::state = this;
    Environment::state = this;
    Vampire::gameState = this;

    // Populate people
	const size_t numPeople = 10;
	personList1.reserve(numPeople);
	personList2.reserve(numPeople);
    for (int i = 0; i != numPeople; ++i) {
        personList1.push_back(new Person(Point(rand()%1800 + 100, rand()%1800 + 100)));
	}

	//hunter = new Hunter( Hunter(Point(400, 400)) );

    map.tileSize = Point(40, 40);
    std::string TILES_PATH = IMAGE_PATH + "Tiles/";
    map.baseProportion = 0.93;
    map.tiles.push_back(TILES_PATH + "Grass.png"); //Important: first [0] is the base tile
    map.tiles.push_back(TILES_PATH + "Brick.png");
    map.tiles.push_back(TILES_PATH + "Brick2.png");
    map.tiles.push_back(TILES_PATH + "BrokenTombstone.png");
    map.tiles.push_back(TILES_PATH + "Dirt.png");
    map.tiles.push_back(TILES_PATH + "GrassRock.png");
    map.tiles.push_back(TILES_PATH + "GrassRockTile2.png");
    map.tiles.push_back(TILES_PATH + "Pebbles.png");
    map.tiles.push_back(TILES_PATH + "Slab.png");
    map.tiles.push_back(TILES_PATH + "Stick.png");
    map.tiles.push_back(TILES_PATH + "Stick2.png");
    map.tiles.push_back(TILES_PATH + "Tombstone.png");
    map.tiles.push_back(TILES_PATH + "Tombstone2.png");

    map.baseObstacleProportion = 0.7;
    map.obstacleTiles.push_back(TILES_PATH + "wallA.png");//Important: first [0] is the base tile
    map.obstacleTiles.push_back(TILES_PATH + "wallB.png");

    map.mapSize = Point(50, 50);
    map.randomize();

    size_t marginSize = Map::MARGIN_SIZE; //ensures borders
    leftBound = marginSize * map.tileSize.x;
    topBound = marginSize * map.tileSize.y;
    rightBound = (map.mapSize.x - marginSize) * map.tileSize.x;
    bottomBound = (map.mapSize.y - marginSize) * map.tileSize.y;

    std::string VAMPIRE_PATH = IMAGE_PATH + "Vampire/";
    idleE = Surface(VAMPIRE_PATH + "idleE.png", true);
    idleF = Surface(VAMPIRE_PATH + "idleF.png", true);
    idleG = Surface(VAMPIRE_PATH + "idleG.png", true);
    idleH = Surface(VAMPIRE_PATH + "idleH.png", true);
    Vampire::setIdleImages(&idleE, &idleF, &idleG, &idleH);
    movingE = Surface(VAMPIRE_PATH + "movingE.png", true);
    movingF = Surface(VAMPIRE_PATH + "movingF.png", true);
    movingG = Surface(VAMPIRE_PATH + "movingG.png", true);
    movingH = Surface(VAMPIRE_PATH + "movingH.png", true);
    Vampire::setMovingImages(&movingE, &movingF, &movingG, &movingH);
    attackingE = Surface(VAMPIRE_PATH + "attackingE.png", true);
    attackingF = Surface(VAMPIRE_PATH + "attackingF.png", true);
    attackingG = Surface(VAMPIRE_PATH + "attackingG.png", true);
    attackingH = Surface(VAMPIRE_PATH + "attackingH.png", true);
    Vampire::setAttackingImages(&attackingE, &attackingF, &attackingG, &attackingH);
    burningL = Surface(VAMPIRE_PATH + "burningL.png", true);
    burningR = Surface(VAMPIRE_PATH + "burningR.png", true);
    Vampire::setBurningImages(&burningL, &burningR);

    std::string deathsPath = IMAGE_PATH + "Death/";

   batDeaths.push_back(Death
       (deathsPath + "batkill.png", &deathScream, 20, 8, Point(128, 128), Point(33, 106)));
   batDeaths.push_back(Death
       (deathsPath + "batkill2.png", &deathScream, 20, 8, Point(128, 128), Point(90, 106)));

   closeDeaths.push_back(Death
       (deathsPath + "farmer_fall.png", &deathScream, 40, 8, Point(128, 128), Point(34, 106)));
   closeDeaths.push_back(Death
       (deathsPath + "farmer_fall2.png", &deathScream, 40, 8, Point(128, 128), Point(91, 106)));
   closeDeaths.push_back(Death
       (deathsPath + "gibletman.png", &deathScream, 41, 8, Point(256, 128), Point(125, 106)));
   closeDeaths.push_back(Death
       (deathsPath + "skeleton.png", &deathBonesSound, 40, 8, Point(128, 128), Point(59, 106)));
   closeDeaths.push_back(Death
       (deathsPath + "skeleton_blow_up.png", &deathBonesScreamSound, 40, 5, Point(384, 128), Point(29, 106)));
   closeDeaths.push_back(Death
       (deathsPath + "skeleton_blow_up2.png", &deathBonesScreamSound, 40, 5, Point(384, 128), Point(352, 106)));
   closeDeaths.push_back(Death
       (deathsPath + "skeleton2.png", &deathBonesSound, 40, 8, Point(128, 128), Point(68, 106)));
   closeDeaths.push_back(Death
       (deathsPath + "explosion_man.png", &deathBonesSound, 50, 8, Point(256, 128), Point(129, 106)));

   // Health bar
   const std::string HEALTH_PATH = IMAGE_PATH + "HealthBar/";
   environment.healthBar_.negativeFillingBar = Surface(HEALTH_PATH + "Blue.png", true);
   environment.healthBar_.outlineBar = Surface(HEALTH_PATH + "Outline.png", true);
   environment.healthBar_.fullBar = Surface(HEALTH_PATH + "Red.png", true);
   environment.healthBar_.positiveFillingBar = Surface(HEALTH_PATH + "Yellow.png", true);


   bloodImages.push_back(Surface(IMAGE_PATH + "Death/blood0.png", true));
   bloodImages.push_back(Surface(IMAGE_PATH + "Death/blood1.png", true));
   bloodImages.push_back(Surface(IMAGE_PATH + "Death/blood2.png", true));
   bloodImages.push_back(Surface(IMAGE_PATH + "Death/blood3.png", true));
   bloodImages.push_back(Surface(IMAGE_PATH + "Death/blood4.png", true));
   bloodImages.push_back(Surface(IMAGE_PATH + "Death/blood5.png", true));
   bloodImages.push_back(Surface(IMAGE_PATH + "Death/blood6.png", true));

   Blood::images = &bloodImages;

}
Ejemplo n.º 7
0
void print_data(bodyptr btab, int nbody, real tnow, string *fields,
		string ifmt, string rfmt)
{
    bodyptr bp;

    for (bp = btab; bp < NthBody(btab, nbody); bp = NextBody(bp)) {
	if (set_member(fields, TimeTag))
	    printf(rfmt, tnow);
	if (set_member(fields, MassTag))
	    printf(rfmt, Mass(bp));
	if (set_member(fields, PosTag)) {
	    printf(rfmt, Pos(bp)[0]);
	    printf(rfmt, Pos(bp)[1]);
	    printf(rfmt, Pos(bp)[2]);
	}
	if (set_member(fields, VelTag)) {
	    printf(rfmt, Vel(bp)[0]);
	    printf(rfmt, Vel(bp)[1]);
	    printf(rfmt, Vel(bp)[2]);
	}
	if (set_member(fields, AccTag)) {
	    printf(rfmt, Acc(bp)[0]);
	    printf(rfmt, Acc(bp)[1]);
	    printf(rfmt, Acc(bp)[2]);
	}
	if (set_member(fields, PhiTag))
	    printf(rfmt, Phi(bp));
	if (set_member(fields, SmoothTag))
	    printf(rfmt, Smooth(bp));
	if (set_member(fields, RhoTag))
	    printf(rfmt, Rho(bp));
	if (set_member(fields, EntFuncTag))
	    printf(rfmt, EntFunc(bp));
	if (set_member(fields, UinternTag))
	    printf(rfmt, Uintern(bp));
	if (set_member(fields, UdotIntTag))
	    printf(rfmt, UdotInt(bp));
        if (set_member(fields, UdotRadTag))
	    printf(rfmt, UdotRad(bp));
        if (set_member(fields, UdotVisTag))
	    printf(rfmt, UdotVis(bp));
	if (set_member(fields, TauTag))
	    printf(rfmt, Tau(bp));
	if (set_member(fields, BirthTag))
	    printf(rfmt, Birth(bp));
	if (set_member(fields, DeathTag))
	    printf(rfmt, Death(bp));
	if (set_member(fields, TypeTag))
	  printf(ifmt, (int) Type(bp));
	if (set_member(fields, KeyTag))
	    printf(ifmt, Key(bp));
	if (set_member(fields, AuxTag))
	    printf(rfmt, Aux(bp));
	if (set_member(fields, AuxVecTag)) {
	    printf(rfmt, AuxVec(bp)[0]);
	    printf(rfmt, AuxVec(bp)[1]);
	    printf(rfmt, AuxVec(bp)[2]);
	}
	printf("\n");
    }
}
Ejemplo n.º 8
0
// 更新
void CSmallEnemy::Update(AppEnv &app_env,Random &random){
	Death();
	DeathEffect(random);
	FireWorksUpdate(app_env, random);
}
Ejemplo n.º 9
0
void Client::HandleAAAction(aaID activate) {
	if (activate < 0 || activate >= aaHighestID)
		return;

	uint8 activate_val = GetAA(activate);

	if (activate_val == 0)
		return;

	if (activate_val > MAX_AA_ACTION_RANKS)
		activate_val = MAX_AA_ACTION_RANKS;
	activate_val--;		//to get array index.

	//get our current node, now that the indices are well bounded
	const AA_DBAction *caa = &AA_Actions[activate][activate_val];

	uint16 timer_id = 0;
	uint16 timer_duration = caa->duration;
	aaTargetType target = aaTargetUser;

	uint16 spell_id = SPELL_UNKNOWN;	//gets cast at the end if not still unknown

	switch (caa->action) {
	case aaActionAETaunt:
		entity_list.AETaunt(this);
		break;

	case aaActionMassBuff:
		EnableAAEffect(aaEffectMassGroupBuff, 3600);
		Message_StringID(MT_Disciplines, MGB_STRING);	//The next group buff you cast will hit all targets in range.
		break;

	case aaActionFlamingArrows:
		//toggle it
		if (CheckAAEffect(aaEffectFlamingArrows))
			EnableAAEffect(aaEffectFlamingArrows);
		else
			DisableAAEffect(aaEffectFlamingArrows);
		break;

	case aaActionFrostArrows:
		if (CheckAAEffect(aaEffectFrostArrows))
			EnableAAEffect(aaEffectFrostArrows);
		else
			DisableAAEffect(aaEffectFrostArrows);
		break;

	case aaActionRampage:
		EnableAAEffect(aaEffectRampage, 10);
		break;

	case aaActionSharedHealth:
		if (CheckAAEffect(aaEffectSharedHealth))
			EnableAAEffect(aaEffectSharedHealth);
		else
			DisableAAEffect(aaEffectSharedHealth);
		break;

	case aaActionCelestialRegen: {
		//special because spell_id depends on a different AA
		switch (GetAA(aaCelestialRenewal)) {
		case 1:
			spell_id = 3250;
			break;
		case 2:
			spell_id = 3251;
			break;
		default:
			spell_id = 2740;
			break;
		}
		target = aaTargetCurrent;
		break;
	}

	case aaActionDireCharm: {
		//special because spell_id depends on class
		switch (GetClass())
		{
		case DRUID:
			spell_id = 2760;	//2644?
			break;
		case NECROMANCER:
			spell_id = 2759;	//2643?
			break;
		case ENCHANTER:
			spell_id = 2761;	//2642?
			break;
		}
		target = aaTargetCurrent;
		break;
	}

	case aaActionImprovedFamiliar: {
		//Spell IDs might be wrong...
		if (GetAA(aaAllegiantFamiliar))
			spell_id = 3264;	//1994?
		else
			spell_id = 2758;	//2155?
		break;
	}

	case aaActionActOfValor:
		if (GetTarget() != nullptr) {
			int curhp = GetTarget()->GetHP();
			target = aaTargetCurrent;
			GetTarget()->HealDamage(curhp, this);
			Death(this, 0, SPELL_UNKNOWN, SkillHandtoHand);
		}
		break;

	case aaActionSuspendedMinion:
		if (GetPet()) {
			target = aaTargetPet;
			switch (GetAA(aaSuspendedMinion)) {
			case 1:
				spell_id = 3248;
				break;
			case 2:
				spell_id = 3249;
				break;
			}
			//do we really need to cast a spell?

			Message(0, "You call your pet to your side.");
			GetPet()->WipeHateList();
			GetPet()->GMMove(GetX(), GetY(), GetZ());
			if (activate_val > 1)
				entity_list.ClearFeignAggro(GetPet());
		}
		else {
			Message(0, "You have no pet to call.");
		}
		break;

	case aaActionProjectIllusion:
		EnableAAEffect(aaEffectProjectIllusion, 3600);
		Message(10, "The power of your next illusion spell will flow to your grouped target in your place.");
		break;


	case aaActionEscape:
		Escape();
		break;

		// Don't think this code is used any longer for Bestial Alignment as the aa.has a spell_id and no nonspell_action.
	case aaActionBeastialAlignment:
		switch (GetBaseRace()) {
		case BARBARIAN:
			spell_id = AA_Choose3(activate_val, 4521, 4522, 4523);
			break;
		case TROLL:
			spell_id = AA_Choose3(activate_val, 4524, 4525, 4526);
			break;
		case OGRE:
			spell_id = AA_Choose3(activate_val, 4527, 4527, 4529);
			break;
		case IKSAR:
			spell_id = AA_Choose3(activate_val, 4530, 4531, 4532);
			break;
		case VAHSHIR:
			spell_id = AA_Choose3(activate_val, 4533, 4534, 4535);
			break;
		}

	case aaActionLeechTouch:
		target = aaTargetCurrent;
		spell_id = SPELL_HARM_TOUCH2;
		EnableAAEffect(aaEffectLeechTouch, 1000);
		break;

	case aaActionFadingMemories:
		// Do nothing since spell effect works correctly, but mana isn't used.
		break;

		default:
			Log.Out(Logs::General, Logs::Error, "Unknown AA nonspell action type %d", caa->action);
			return;
	}


	uint16 target_id = 0;
	//figure out our target
	switch (target) {
	case aaTargetUser:
	case aaTargetGroup:
		target_id = GetID();
		break;
	case aaTargetCurrent:
	case aaTargetCurrentGroup:
		if (GetTarget() == nullptr) {
			Message_StringID(MT_DefaultText, AA_NO_TARGET);	//You must first select a target for this ability!
			p_timers.Clear(&database, timer_id + pTimerAAEffectStart);
			return;
		}
		target_id = GetTarget()->GetID();
		break;
	case aaTargetPet:
		if (GetPet() == nullptr) {
			Message(0, "A pet is required for this skill.");
			return;
		}
		target_id = GetPetID();
		break;
	}

	//cast the spell, if we have one
	if (IsValidSpell(spell_id)) {
		int aatid = GetAATimerID(activate);
		if (!CastSpell(spell_id, target_id, USE_ITEM_SPELL_SLOT, -1, -1, 0, -1, pTimerAAStart + aatid, CalcAAReuseTimer(caa), 1)) {
			SendAATimer(activate, 0, 0xFFFFFF);
			Message_StringID(CC_Yellow, ABILITY_FAILED);
			p_timers.Clear(&database, pTimerAAStart + aatid);
			return;
		}
	}

	//handle the duration timer if we have one.
	if (timer_id > 0 && timer_duration > 0) {
		p_timers.Start(pTimerAAEffectStart + timer_id, timer_duration);
	}
}