void EspadachinIA::Recovery() { if(getLife()<100){ setLife(getLife()+1); } }
ParticleMeteorSystem() : wyQuadParticleSystem(150) { // duration setDuration(PARTICLE_DURATION_INFINITY); // gravity setParticleGravity(DP(-133.33f), DP(133.33f)); // angle setDirectionAngleVariance(90, 360); // speed of particles setSpeedVariance(DP(10), DP(3.33f)); // life of particles setLifeVariance(2, 1); // size, in pixels setStartSizeVariance(DP(40.0f), DP(6.6f)); // emits per second setEmissionRate(getMaxParticles() / getLife()); // color of particles setStartColorVariance(0.2f, 0.4f, 0.7f, 1.0f, 0.0f, 0.0f, 0.2f, 0.1f); setEndColorVariance(0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f); //set texture setTexture(wyTexture2D::makePNG(RES("R.drawable.fire"))); // additive setBlendAdditive(true); }
void CPlayerBase::update(float elapsed) { PROFILE_FUNCTION("update base"); if (camera.isValid()) { if (onCinematic) { UpdateCinematic(elapsed); } else if (controlEnabled || only_sense) { bool alive = !checkDead(); if (alive && inputEnabled) { energy_decrease = energy_default_decrease; // Default if nobody change that this frame UpdateSenseVision(); if (!only_sense) { UpdateMoves(); UpdateInputActions(); } setLife(getLife() - getDeltaTime() * energy_decrease); } Recalc(); if (alive) { //UpdateMoves(); myUpdate(); update_msgs(); } } //UpdateAnimation(); } }
void Bear::Update(float _Time, int** _Terrain,float _MaxWidth,float _MaxHeight) { if(getLife() == false) { int random ; random = rand() % 4 ; switch(random) { case 0 : Item *_item = new Item(m_X,m_Y); ManagerObject::Instance()->getListItem()->push_back(_item); break ; } EffectDieBear *_EffectDie = new EffectDieBear(this,m_X,m_Y); ManagerObject ::Instance()->getListEffect()->push_back(_EffectDie); } if(m_skillManager->getSkill(0)->getSTT()==ACTIVE) { m_skillManager->Update(_Time,_Terrain,_MaxWidth,_MaxHeight); } else if(m_skillManager->getSkill(0)->getSTT() !=ACTIVE) { if(getFrenzy() ==false) { Move(_Time,_Terrain,_MaxWidth,_MaxHeight); } Animation(_Time); UpdateStatus(_Time); m_skillManager->Update(_Time,_Terrain,_MaxWidth,_MaxHeight); //?? } }
ParticleFireSystem() : wyQuadParticleSystem(250){ // duration setDuration(PARTICLE_DURATION_INFINITY); // angle setDirectionAngleVariance(90, 10); // life of particles setLifeVariance(3.0f, 0.25f); // speed of particles setSpeedVariance(60, 20); // size, in pixels setStartSizeVariance(100.0f, 10.0f); // emits per frame setEmissionRate(getMaxParticles() / getLife()); // color of particles setStartColorVariance(0.76f, 0.25f, 0.12f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f); setEndColorVariance(0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f); //set texture setTexture(wyTexture2D::makePNG(RES("R.drawable.fire"))); // additive setBlendAdditive(true); }
void Frog::killed() { setLife(getLife() - 1); setPositionXXs(3.0); setPositionYYs(-13.0); setPositionZZs(-2.0); }
ParticleSpiralSystem() : wyQuadParticleSystem(500){ // duration setDuration(PARTICLE_DURATION_INFINITY); // angle setDirectionAngleVariance(90, 0); // speed of particles setSpeedVariance(150, 0); // radial setRadialAccelerationVariance(-380, 0); // tagential setTangentialAccelerationVariance(45, 0); // life of particles setLifeVariance(12, 0); // size, in pixels setStartSizeVariance(20, 0); // emits per second setEmissionRate(getMaxParticles() / getLife()); // color of particles setStartColorVariance(0.5f, 0.5f, 0.5f, 1.0f, 0.5f, 0.5f, 0.5f, 0.0f); setEndColorVariance(0.5f, 0.5f, 0.5f, 1.0f, 0.5f, 0.5f, 0.5f, 0.0f); //set texture setTexture(wyTexture2D::makePNG(RES("R.drawable.fire"))); // additive setBlendAdditive(false); }
ParticleSmokeSystem() : wyQuadParticleSystem(200){ // duration setDuration(PARTICLE_DURATION_INFINITY); // angle setDirectionAngleVariance(90, 5); // position var setParticlePositionVariance(0, 0, 20, 0); // life of particles setLifeVariance(4, 1); // speed of particles setSpeedVariance(25, 10); // size, in pixels setStartSizeVariance(60, 10); // emits per frame setEmissionRate(getMaxParticles() / getLife()); // color of particles setStartColorVariance(0.8f, 0.8f, 0.8f, 1.0f, 0.02f, 0.02f, 0.02f, 0.0f); setEndColorVariance(0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f); //set texture setTexture(wyTexture2D::makePNG(RES("R.drawable.fire"))); // additive setBlendAdditive(false); }
void Robot::print(std::ostream& st) const { st << "robot_" << getName() << "(" << getOrientation().getName() << "," << getLife() << "," << getColor() << ")"; if (getHand() != nullptr) st << "[" << *(getHand()) << "]"; }
void ParticlePerformTest4::doTest() { auto s = Director::getInstance()->getWinSize(); auto particleSystem = (ParticleSystem*) getChildByTag(kTagParticleSystem); // duration particleSystem->setDuration(-1); // gravity particleSystem->setGravity(Vec2(0,-90)); // angle particleSystem->setAngle(90); particleSystem->setAngleVar(0); // radial particleSystem->setRadialAccel(0); particleSystem->setRadialAccelVar(0); // speed of particles particleSystem->setSpeed(180); particleSystem->setSpeedVar(50); // emitter position particleSystem->setPosition(Vec2(s.width/2, 100)); particleSystem->setPosVar(Vec2(s.width/2,0)); // life of particles particleSystem->setLife(2.0f); particleSystem->setLifeVar(1); // emits per frame particleSystem->setEmissionRate(particleSystem->getTotalParticles() / particleSystem->getLife()); // color of particles Color4F startColor(0.5f, 0.5f, 0.5f, 1.0f); particleSystem->setStartColor(startColor); Color4F startColorVar(0.5f, 0.5f, 0.5f, 1.0f); particleSystem->setStartColorVar(startColorVar); Color4F endColor(0.1f, 0.1f, 0.1f, 0.2f); particleSystem->setEndColor(endColor); Color4F endColorVar(0.1f, 0.1f, 0.1f, 0.2f); particleSystem->setEndColorVar(endColorVar); // size, in pixels particleSystem->setEndSize(64.0f); particleSystem->setStartSize(64.0f); particleSystem->setEndSizeVar(0); particleSystem->setStartSizeVar(0); // additive particleSystem->setBlendAdditive(false); }
void Robot::save(std::ostream& st) const { st << "robot_" << getName() << "_" << getOrientation().getName() << "_" << getLife() << "_" << getColor(); if (getHand() != nullptr) { st << "_"; getHand()->save(st); } }
void EnemyLayer::removeAllEnemy1() { Ref* obj; CCARRAY_FOREACH(m_pAllEnemy1, obj) { auto enemy1 = (Enemy*)obj; if (enemy1->getLife() > 0) { enemy1Blowup(enemy1); } }
//Constructor from the code of AI and the level of the different capacities Unit::Unit(std::string iaCode, int speedLevel, int lifeLevel, int armorLevel, int regenLevel, int damageLevel, int rangeLevel, int firerateLevel) { init_(); this->iaCode_ = iaCode; tree = std::shared_ptr<TreeElement>((TreeElement*)NodeConstructor::create(&iaCode)); getSpeed().upgrade(speedLevel); getLife().upgrade(lifeLevel); getArmor().upgrade(armorLevel); getRegen().upgrade(regenLevel); getDamage().upgrade(damageLevel); getRange().upgrade(rangeLevel); getFirerate().upgrade(firerateLevel); }
std::string Snake::getAnimationName() { std::string result = ""; if (_dir != NONE) { switch (_type) { case SNAKE_HEAD: result = isVertical(_dir) ? "snake_vertical_head_" : "snake_horizontal_head_"; break; case SNAKE_BODY: result = isVertical(_dir) ? "snake_vertical_body_" : "snake_horizontal_body_"; break; case SNAKE_TAIL: result = isVertical(_dir) ? "snake_vertical_tail_" : "snake_horizontal_tail_"; break; default: return result; } } return result + myUtils::to_string(getLife()); }
ParticleFireworkSystem() : wyQuadParticleSystem(300){ // duration setDuration(PARTICLE_DURATION_INFINITY); // gravity setParticleGravity(0, -90); // angle setDirectionAngleVariance(90, 20); // speed of particles setSpeedVariance(180, 50); // life of particles setLifeVariance(3.5f, 1.0f); // emits per frame setEmissionRate(getMaxParticles() / getLife()); // color of particles setStartColorVariance(0.5f, 0.5f, 0.5f, 1.0f, 0.5f, 0.5f, 0.5f, 1.0f); setEndColorVariance(0.1f, 0.1f, 0.1f, 0.2f, 0.1f, 0.1f, 0.1f, 0.2f); // size, in pixels setStartSizeVariance(8.0f, 2.0f); setEndSizeVariance(PARTICLE_START_SIZE_EQUAL_TO_END_SIZE, 0); // emits per second setEmissionRate(getMaxParticles() / getLife()); //set texture setTexture(wyTexture2D::makePNG(RES("R.drawable.fire"))); // additive setBlendAdditive(false); }
void GodLike_Beast ::ProcessCollision(MyObject* _Obj) { m_skillManager->ProcessCollision(_Obj); if(getLife() == true) { if(!getRect().iCollision(_Obj->getRect())) { if(abs(_Obj->getX() - m_X ) < 1000 ) { if(_Obj->getX() > m_X ) { m_Direct =1 ; } if(_Obj->getX() < m_X) { m_Direct = -1 ; } } // if(abs(_Obj->getX() - m_X ) > 1000 ) // { // if( m_skillManager->getSkill(1)->getSTT()!=ACTIVE && m_skillManager->getSkill(2)->getSTT()!=ACTIVE && m_skillManager->getSkill(3)->getSTT()!=ACTIVE&& m_skillManager->getSkill(0)->getSTT()!=ACTIVE ) // ActiveSkill(4); // // } } if(getRect().iCollision(_Obj->getRect())) { if(_Obj->getDirection() > 0 && _Obj->getX() > m_X ) { if(m_Direct <0) { m_Direct = 1 ; m_X = m_X + 50; } } else if(_Obj->getDirection() < 0 && _Obj->getX() < m_X ) { if(m_Direct > 0) { m_Direct =-1 ; m_X = m_X + 60; } } } } }
void GodLike_Beast ::Update(float _Time, int** _Terrain,float _MaxWidth,float _MaxHeight) { if(getLife() == false) { EffectLeonDie *_EffectDie = new EffectLeonDie (m_X,m_Y); ManagerObject::Instance()->getListEffect()->push_back(_EffectDie); return ; } int random ; random = rand() % 4; m_TimeUpdate+=_Time ; if(m_TimeUpdate > 2) { switch (random) { case 0: if( m_skillManager->getSkill(1)->getSTT()!=ACTIVE && m_skillManager->getSkill(2)->getSTT()!=ACTIVE && m_skillManager->getSkill(3)->getSTT()!=ACTIVE&& m_skillManager->getSkill(4)->getSTT()!=ACTIVE ) ActiveSkill(0); m_TimeUpdate= 0 ; break; case 1: if( m_skillManager->getSkill(0)->getSTT()!=ACTIVE && m_skillManager->getSkill(2)->getSTT()!=ACTIVE && m_skillManager->getSkill(3)->getSTT()!=ACTIVE && m_skillManager->getSkill(4)->getSTT()!=ACTIVE ) ActiveSkill(1); m_TimeUpdate = 0 ; break ; case 2: if( m_skillManager->getSkill(0)->getSTT()!=ACTIVE && m_skillManager->getSkill(1)->getSTT()!=ACTIVE && m_skillManager->getSkill(3)->getSTT()!=ACTIVE && m_skillManager->getSkill(4)->getSTT()!=ACTIVE ) ActiveSkill(2); m_TimeUpdate = 0 ; break ; case 3: if( m_skillManager->getSkill(0)->getSTT()!=ACTIVE && m_skillManager->getSkill(1)->getSTT()!=ACTIVE && m_skillManager->getSkill(2)->getSTT()!=ACTIVE && m_skillManager->getSkill(4)->getSTT()!=ACTIVE ) ActiveSkill(3) ; m_TimeUpdate = 0 ; break ; } } if( m_skillManager->getSkill(0)->getSTT()!=ACTIVE && m_skillManager->getSkill(1)->getSTT()!=ACTIVE && m_skillManager->getSkill(2)->getSTT()!=ACTIVE && m_skillManager->getSkill(3)->getSTT()!=ACTIVE && m_skillManager->getSkill(4)->getSTT()!=ACTIVE ) { Animation(_Time); Move(_Time,_Terrain,_MaxWidth,_MaxHeight); } m_skillManager->Update(_Time,_Terrain,_MaxWidth,_MaxHeight) ; UpdateStatus(_Time); }
void Snake::dead() { auto life = getLife() - 1; if (canDead(life)) { if (life <= 0) { _isDead = true; int count = 0; for (auto snake : _snakeVec) { if (snake->isDead()) count++; } if (count >= (int)_snakeVec.size() / 2) { for (auto snake : _snakeVec) { snake->runDeadAnimation(); } } } else { int minLife = 999; for (auto snake : _snakeVec) { int l = snake->getLife(); if (l < minLife) { minLife = l; } } for (auto snake : _snakeVec) { if (snake->getLife() == minLife) { newTimeCreate(); } } newTimeCreate(); _sprite->runAction(getBlinkAction(_dir)); } } }
ParticleSnowSystem() : wyQuadParticleSystem(700){ // duration setDuration(PARTICLE_DURATION_INFINITY); // gravity setParticleGravity(0, -10); // angle setDirectionAngleVariance(-90, 5); // speed of particles setSpeedVariance(130, 30); // radial setRadialAccelerationVariance(0, 1); // tagential setTangentialAccelerationVariance(0, 1); // emitter position setParticlePositionVariance(0, 0, wyDevice::winWidth / 2, 0); // life of particles setLifeVariance(3, 1); // size, in pixels setStartSizeVariance(10, 5); // emits per second setEmissionRate(getMaxParticles() / getLife()); // color of particles setStartColorVariance(0.9f, 0.9f, 0.9f, 1.0f, 0.0f, 0.0f, 0.1f, 0.0f); setEndColorVariance(1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); //set texture setTexture(wyTexture2D::makePNG(RES("R.drawable.snow"))); // additive setBlendAdditive(false); }
void Robot::loseHP(int nbHP) { assert(nbHP > 0); int newLife = getLife() - nbHP; newLife = newLife < 0 ? 0:newLife; m_life = newLife; // Si un robot perd des PVs alors qu'il porte un rocher et que ce rocher devient plus lourd que lui, il est écrasé et meurt sur le coup. if (getHand() != nullptr) { if (std::shared_ptr<Rock> rock = std::dynamic_pointer_cast<Rock>(getHand())) { if (rock->getWeight() > m_life) { destroy(); return; } } } // Plus de vie if (m_life == 0) { destroy(); } }
ParticleRotateFlowerSystem() : wyQuadParticleSystem(50){ // duration setDuration(PARTICLE_DURATION_INFINITY); // Gravity mode: speed of particles setSpeedVariance(160, 20); // Gravity mode: radial setRadialAccelerationVariance(-120, 0); // Gravity mode: tagential setTangentialAccelerationVariance(30, 0); // angle setDirectionAngleVariance(90, 360); // life of particles setLifeVariance(3, 1); // spin of particles setEndSpinVariance(0, 2000); // color of particles setStartColorVariance(0.5f, 0.5f, 0.5f, 1.0f, 0.5f, 0.5f, 0.5f, 1.0f); setEndColorVariance(0.1f, 0.1f, 0.1f, 0.2f, 0.1f, 0.1f, 0.1f, 0.2f); // size, in pixels setStartSizeVariance(30, 0); setEndSizeVariance(PARTICLE_START_SIZE_EQUAL_TO_END_SIZE, 0); // emits per second setEmissionRate(getMaxParticles() / getLife()); //set texture setTexture(wyTexture2D::makePNG(RES("R.drawable.stars2"))); // additive setBlendAdditive(false); }
void Hero::Update(float _Time, int** _Terrain,float _MaxWidth,float _MaxHeight) { if(getLife()==false&&m_Test_Die==false) { if (m_Direct<0) { Hero_Die *m_HeroDie = new Hero_Die(m_X-50,m_Y-50); m_HeroDie->m_InfoSprite.setScaleX(1); ManagerObject::Instance()->getListEffect()->push_back(m_HeroDie); } else { Hero_Die *m_HeroDie = new Hero_Die(m_X-100,m_Y-50); m_HeroDie->m_InfoSprite.setScaleX(-1); ManagerObject::Instance()->getListEffect()->push_back(m_HeroDie); } m_Test_Die=true; } else{ if(m_skillManager->getSkill(0)->getSTT()==ACTIVE||m_skillManager->getSkill(1)->getSTT()==ACTIVE||m_skillManager->getSkill(2)->getSTT()==ACTIVE||m_skillManager->getSkill(3)->getSTT()==ACTIVE) { m_skillManager->Update(_Time,_Terrain,_MaxWidth,_MaxHeight); } else { UpdateStatus(_Time); Animation(_Time); Move(_Time,_Terrain,_MaxWidth,_MaxHeight); m_skillManager->Update(_Time,_Terrain,_MaxWidth,_MaxHeight); } m_Pet->Update(_Time,_Terrain,_MaxWidth,_MaxHeight); } }
void Player::fire(int tx, int ty) { Thing& thing = login.getThing(); if (!thing.isAlive()) { return; } send("@fire requested"); // fire (-1, 5); target, at most // client (x,y) beginning Game& game = Game::getGame(); ID x = thing.getX(); ID y = thing.getY(); int fr = getFirerange(); printf("life: %d, range %d", getLife(), getFirerange()); for(int i=1; i<=fr; i++) { //send("Fire loop"); ID nid = game.getCell(ID(x.asInt() + i*tx),ID(y.asInt() + i*ty)); game.setTransient(ID(x.asInt() + i*tx),ID(y.asInt() + i*ty),1,0.5); long int myid = nid.asInt(); if (myid != 0) { if(myid >= 100) { Thing& other = game.getThing(myid); other.setLife(other.getLife() - 1000); if(other.getLife() <= 0) other.setLifetime(0); } break; // something hit } } //send("Fire finished"); }
int wallerFireDmg() { // aumentar potencia de daño si la vida es igual o inferior al porcentaje indicado int FURY_PERCENT = 15; int dmg; int opponents = getOpponents(); if (opponents > 2) { // 3 o 4 oponentes -> daño = 3 dmg = 3; } else { // 1 o 2 oponentes -> daño = 4 dmg = 4; } if (LAST_TURN_FIRE != -1 && LAST_TURN_FIRE != getTurn()) { // 4 (o más) turnos sin disparar -> aumentar en +2 el daño // 3 (o más) turnos sin disparar -> aumentar en +1 el daño if ((getTurn() - LAST_TURN_FIRE) >= 4) { dmg += 2; } else if ((getTurn() - LAST_TURN_FIRE) >= 3) { dmg += 1; } } // aumentar potencia de daño si la vida es inferior a FURY_PERCENT% if (getLife() <= (FURY_PERCENT * DEFAULT_LIFE / 100)) { // si está en 1 vs 1 -> aumentar en +2 el daño // aumentar en +1 en cualquier otro caso. if (opponents == 1) { dmg += 2; } else { dmg += 1; } } return dmg; }
void Hero::Draw(D3DXMATRIX _MWorld,LPD3DXSPRITE _Handler) { if (m_Direct<0) { m_InfoSpriteHero.setScaleX(1); } else { m_InfoSpriteHero.setScaleX(-1); } if(getLife()==false) { m_InfoHero_Die.setXY(m_X,m_Y); m_Hero_Die->Draw(_MWorld,m_InfoSpriteHero,_Handler); } else { if(m_skillManager->getSkill(0)->getSTT()==ACTIVE||m_skillManager->getSkill(1)->getSTT()==ACTIVE||m_skillManager->getSkill(2)->getSTT()==ACTIVE||m_skillManager->getSkill(3)->getSTT()==ACTIVE) { for(int i=0;i<m_skillManager->getList().size();i++) if(m_skillManager->getSkill(i)->getSTT()==ACTIVE) { m_skillManager->getSkill(i)->Draw(_MWorld,_Handler); } } else { m_InfoSpriteHero.setXY(m_X,m_Y-3); m_SpriteHero->Draw(_MWorld,m_InfoSpriteHero,_Handler); } m_Pet->Draw(_MWorld,_Handler); } }
void LetterParticle::draw() { ofPushMatrix(); ofTranslate(position); ofPushStyle(); ofNoFill(); ofColor startColor = ofColor::yellow; ofColor endColor = ofColor::white; ofColor myColor = startColor; myColor.lerp(endColor, getLife()); ofSetColor(myColor); font.drawStringAsShapes(text,0,0); ofPopStyle(); ofPopMatrix(); }
ParticleModernArtSystem() : wyQuadParticleSystem(1000){ // duration setDuration(PARTICLE_DURATION_INFINITY); // Gravity mode: radial setRadialAccelerationVariance(70, 10); // Gravity mode: tangential setTangentialAccelerationVariance(80, 0); // Gravity mode: speed of particles setSpeedVariance(50, 10); // angle setDirectionAngleVariance(0, 360); // life of particles setLifeVariance(2.0f, 0.3f); // emits per frame setEmissionRate(getMaxParticles() / getLife()); // color of particles setStartColorVariance(0.5f, 0.5f, 0.5f, 1.0f, 0.5f, 0.5f, 0.5f, 1.0f); setEndColorVariance(0.1f, 0.1f, 0.1f, 0.2f, 0.1f, 0.1f, 0.1f, 0.2f); // size, in pixels setStartSizeVariance(1.0f, 1.0f); setEndSizeVariance(32.0f, 8.0f); //set texture setTexture(wyTexture2D::makePNG(RES("R.drawable.fire"))); // additive setBlendAdditive(false); }
//Refresh the capacities of the unit, most often used at the beginning of fight turn. //Reduce the cooldown of the firerate, and apply the regen on the life void Unit::refresh() { getLife().takeRegen(getRegen().getValue()); getFirerate().reload(); }
//Apply the damages to the unit, by first reducing them by the armor, //then apply it to the life. void Unit::takeDamage(double value) { getLife().takeDamage(value); }
void ArqueroIA::Recovery() { setLife(getLife()+1); }