Exemplo n.º 1
0
void LLPanelTopInfoBar::draw()
{
	updateParcelInfoText();
	updateHealth();

	LLPanel::draw();
}
Exemplo n.º 2
0
void Stats::updateFinalStats() {
  updateHealth();
  updateMana();
  updateAttack();
  updateMagicAttack();
  updateDefense();
  updateMagicDefense();
  updateDodge();
  updateHit();
}
Exemplo n.º 3
0
// virtual
void LLStatusBar::draw()
{
	refresh();
//MK
	updateParcelInfoText();
	updateHealth();
//mk

	LLPanel::draw();
}
void LLPanelTopInfoBar::draw()
{
//MK
	if (gRRenabled && gAgent.mRRInterface.mContainsShowloc)
	{
		toggle_show_mini_location_panel(LLSD(false));
		gSavedSettings.setBOOL ("ShowMiniLocationPanel", FALSE);
	}
//mk
	updateParcelInfoText();
	updateHealth();

	LLPanel::draw();
}
Exemplo n.º 5
0
    void CreatureStats::levelUp()
    {
        const MWWorld::Store<ESM::GameSetting> &gmst =
            MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();

        const int endurance = getAttribute(ESM::Attribute::Endurance).getBase();

        // "When you gain a level, in addition to increasing three primary attributes, your Health
        // will automatically increase by 10% of your Endurance attribute. If you increased Endurance this level,
        // the Health increase is calculated from the increased Endurance"
        mLevelHealthBonus += endurance * gmst.find("fLevelUpHealthEndMult")->getFloat();
        updateHealth();

        mLevel++;
    }
Exemplo n.º 6
0
void MainWindow::on_rangeButton_clicked()
{
    if(enemy.takeDamage(player.rangeAttack(desc))){
        QString temp;
        desc += "\n\nThe " + enemy.getName() + " is still alive\n\n"
             + "It " + enemy.atkDes() + " for " + temp.setNum(enemy.attack()) + " damage";
        if(!player.takedamage(enemy.attack())){
            GameOver();
        }
        updateHealth();
    }
    else{
        desc += "\n\nYou have killed the " + enemy.getName() + "\n\n" + rollReward();
        player.kill();
        exitCombat();
    }
    ui->description->setText(desc);
}
Exemplo n.º 7
0
void GameScene::updateProjectiles(float dt)
{
	if (m_bullets->count() > 0)
	{
		CCObject* ob = NULL;
		CCARRAY_FOREACH(m_bullets, ob)
		{
			Projectile* proj = dynamic_cast<Projectile*>(ob);
			proj->update(dt);

			if (proj->getPositionX() < 0.f - proj->getContentSize().width || proj->getPositionX() > m_visibleSize.width + proj->getContentSize().width)
				m_removableBullets->addObject(proj);
			else if (checkCollisions(m_hero, proj) && proj->getType() == Projectile::Bullet)
			{
				m_removableBullets->addObject(proj);
				updateHealth(10); // dmg value here
			}
			else
			{
				for (uint i = 0; i < m_enemies->count(); ++i)
				{
					Enemy* en = dynamic_cast<Enemy*>(m_enemies->objectAtIndex(i));
					if (checkCollisions(en, proj) && proj->getType() == Projectile::Rocket)
					{
						m_removableBullets->addObject(proj);
						m_removables->addObject(m_enemies->objectAtIndex(i));
						
						CCParticleSystemQuad * smokeParticle = CCParticleSystemQuad::create("textures/smoke.plist"); 
						smokeParticle->setPosition(en->getPosition());
						this->addChild(smokeParticle);
						smokeParticle->setAutoRemoveOnFinish(true);
						
						CCParticleSystemQuad * dustParticle = CCParticleSystemQuad::create("textures/dusts.plist");
						dustParticle->setPosition(en->getPosition());
						this->addChild(dustParticle);
						dustParticle->setAutoRemoveOnFinish(true);
						CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("audio/rocketExplode.wav", false);
						CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("audio/enemyKill.wav", false);

						updateScore(); //score value here
					}
				}
			}
		}
Exemplo n.º 8
0
void MWMechanics::NpcStats::levelUp()
{
    mLevelProgress -= 10;
    for (int i=0; i<ESM::Attribute::Length; ++i)
        mSkillIncreases[i] = 0;

    const MWWorld::Store<ESM::GameSetting> &gmst =
        MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();

    const int endurance = getAttribute(ESM::Attribute::Endurance).getBase();

    // "When you gain a level, in addition to increasing three primary attributes, your Health
    // will automatically increase by 10% of your Endurance attribute. If you increased Endurance this level,
    // the Health increase is calculated from the increased Endurance"
    mLevelHealthBonus += endurance * gmst.find("fLevelUpHealthEndMult")->getFloat();
    updateHealth();

    setLevel(getLevel()+1);
}
Exemplo n.º 9
0
void MainWindow::on_bitchout_clicked()
{
    int roll = qrand() % 3;

    if(roll == 0){
        ui->description->setText("You try to run away...\n\nYou get away!");
        exitCombat();
    }
    else{
        QString temp;
        desc = "You try to run away...\n\nCan't Escape!\n\nThe " + enemy.getName()
                + " " + enemy.atkDes() + " for "
                + temp.setNum(enemy.attack()) + " damage";
        ui->description->setText(desc);
        if(!player.takedamage(enemy.attack())){
            GameOver();
        }
        updateHealth();
    }
}
Exemplo n.º 10
0
void MainWindow::exitCombat(){
    //enable movement
    ui->UpArrow->setEnabled(true);
    ui->UpLabel->setEnabled(true);
    ui->RightArrow->setEnabled(true);
    ui->RightLabel->setEnabled(true);
    ui->LeftArrow->setEnabled(true);
    ui->LeftLabel->setEnabled(true);

    //disable actions
    ui->rangeButton->setEnabled(false);
    ui->bitchout->setEnabled(false);
    ui->meleeButton->setEnabled(false);
    ui->noactions->setHidden(false);

    //clear pic
    ui->PDisplay->clear();
    player.hpUp();
    updateHealth();
}
Exemplo n.º 11
0
void ShipStats::update(float timestep)
{
	// If this ship is the player ship and it is within proximity of the passenger ship
	// if its health, energy or fuel are low, begin replenishing and let the player know
	// they are being replenished
	if (getParent()->getName() == "player1")
	{
		if (Utility::getDistance(m_passengerShip->getPosition(), *getTransform()->getPosition()) <= 500.0f)
		{
			m_dialogueBox->sendMessage("Message From [colour='FFFFFF00']Terra 1 :\n[colour='FFFFFFFF']Stay close,\n we'll replenish your reserves.", Importance::LOW, false);

			if (m_playRechargeSound)
			{
				m_rechargeSound->play();
				m_playRechargeSound = false;
			}

			if (m_health < 1.0f)
			{
				updateHealth(0.0005f);
				if (!m_healing)
				{
					m_healing = true;
					if (m_health > m_dangerlevel)
					{
						m_healthWarnOnce = false;
					}
				}
			}
			else
			{
				m_healing = false;
			}

			if (m_energy < 1.0f)
			{
				updateEnergy(0.0005f);
				if (!m_energizing)
				{
					m_energizing = true;
					if (m_energy > m_dangerlevel)
					{
						m_energyWarnOnce = false;
					}
				}
			}
			else
			{
				m_energizing = false;
			}

			if (m_fuel < 1.0f)
			{
				updateFuel(0.0005f);
				if (!m_fueling)
				{
					m_fueling = true;
					if (m_fuel > m_dangerlevel)
					{
						m_fuelWarnOnce = false;
					}
				}
			}
			else
			{
				m_fueling = false;
			}
		}
		else
		{
			m_playRechargeSound = true;
			m_playMessageReceived = true;
		}

		if (m_fuel <= 0.0f)
		{
			getParent()->getGameComponent<PlayerShipMovementController>()->setVelocity(0.0f);
		}
	}


	if (m_health <= 0.0f)
	{
		if (getParent()->getName() != "player1" && getParent()->getName() != "passengerShip1")
		{
			//Remove gameobject from the minimap
			MiniMap * map;
			map = getGameObjectByName("MiniMap")->getGameComponent<MiniMap>();
			map->deleteMapMarker(getParent()->getName());

			//Remove the homing missile target of this gameobject
			std::vector<GameObject*> missiles = getGameObjectsByName("Missile");
			//MissileAI* missileAIComponent;
			for (size_t i = 0; i < missiles.size(); i++)
			{
				/*for (size_t j = 0; j < missiles[i]->getAllGameComponents().size(); j++)
				{
				missileAIComponent = dynamic_cast<MissileAI*>(missiles[j]->getAllGameComponents()[j]);
				if (missileAIComponent != nullptr)
				{
				missileAIComponent->removeTarget(getParent()->getName());
				break;
				}
				}*/
				//MissileAI* missileAI = missiles[i]->getGameComponent<MissileAI>();
				//missileAI->removeTarget(getParent()->getName());

				missiles[i]->getGameComponent<MissileAI>()->removeTarget(getParent()->getName());
			}
			destroy(getParent());
		}
		else
		{
			getParent()->setEnabled(false);
			//Game Over scene
			getCoreEngine()->getSceneManager()->push(new GameOverScene(), Modality::Popup);
		}
		
	}
}