void StartDefense() { Player* player = getNearestPlayer(); if (player == nullptr) return; //Don't do anything with alliance players if (player->IsTeamAlliance()) return; float player_x = player->GetPositionX(); float player_y = player->GetPositionY(); float player_z = player->GetPositionZ(); //hardcoded values... // the guards should cast the spell if someone is behind them... if (player_x < 5761.9f && player_x >5738.68f && player_y < 732.12f && player_y >712.09f && player_z > 635.0f) { getCreature()->setTargetGuid(player->getGuid()); getCreature()->EventCastSpell(player, sSpellCustomizations.GetSpellInfo(54028)); } else { getCreature()->setTargetGuid(0); //Reset target... ugly } }
void MainWindow::changedCreature( int index ) { switch (index) { //// case 0: setCreature(*new Creature()); //// break; //// case 1: setCreature(*new BasicCreature()); //// break; //// case 2: setCreature(*new QuadrupedCreature()); //// break; //// case 3: setCreature(*new HumanCreature()); //// break; //// case 4: setCreature(*new HalfHumanCreature()); //// break; // default: // DEBUG(TO_STRING(index)); // assert(0); } getUiInspector().sbx_bodies->setEnabled(index == 0); getUiInspector().sbx_constraints->setEnabled(index == 0); getUiInspector().btn_creature_add->setEnabled(index > 0); getUiInspector().btn_create_creature->setEnabled(index > 0); getUiInspector().sbx_bodies->setValue(getCreature().getNumberOfBodyParts()); getUiInspector().sbx_constraints->setValue(getCreature().getNumberOfConstraints()); // getUiInspector().sbx_hidden_layers->setValue(getCreature().getHiddenLayers()); // getUiInspector().sbx_neurons_per_layer->setValue(getCreature().getNeuronsPerLayer()); }
void StartDefense() { Player* player = getNearestPlayer(); if (player == nullptr) return; //Don't do anything with horde players if (player->IsTeamHorde()) return; float player_x = player->GetPositionX(); float player_y = player->GetPositionY(); float player_z = player->GetPositionZ(); //hardcoded values... // the guards should cast the spell if someone is behind them... if (player_x < 5891.88f && player_x >5858.89f && player_y < 594.99f && player_y >565.51f && player_z > 635.0f) { getCreature()->setTargetGuid(player->getGuid()); getCreature()->EventCastSpell(player, sSpellCustomizations.GetSpellInfo(54029)); } else { getCreature()->setTargetGuid(0); //Reset target... ugly } }
spatialRobocodeCreatureMvP::spatialRobocodeCreatureMvP(bool make) { thisCreatureNumber = creatureIdentifierCount++; compsWon = 0; geneticAge =0; if (make) { int maxTree; bool done = false; geneticAge = 0; do { maxTree = randomint(8)+2; critter.reset(new cr_data); critter->makeptc2(maxTree); done = critter->isValid(); } while (!done); isInvalid = false; //cout << "New valid spatialRobocodeCreatureMvP(true) creature created, with max size " << maxTree << "and id " << thisCreatureNumber << endl; char fname[200]; char jname[200]; char gname[200]; sprintf(gname,"Gen%d",currentGen); //cout << "Thinking of saving " << getName() << endl; if (!(getCreature()->isValid())) { cout << "Weird, newly created creature is not valid\n"; exit(1); } sprintf(fname,"%s",getName()); sprintf(jname,"%s.java",fname); ofstream robotout; robotout.open(jname); robocodeBeta::Instance()->print_grammar_individual(robotout,getCreature()->getExpression(),getCreature()->getExpressionLength(),fname,gname); robotout.close(); } }
int Combatant::applyTrefferpunkte(int tp) { int oldLe = getCreature()->getLe(); getCreature()->damageLe(tp); int newLe = getCreature()->getLe(); return oldLe - newLe; }
void Combatant::doParade(JobSet* jobSet, Combatant* target, int paradeResult) { // For the start, we just turn this to face target manually here. Vector3 pos = getCreature()->getPosition(); pos.y = 0; Vector3 targetPos = target->getCreature()->getPosition(); targetPos.y = 0; getCreature()->setOrientation(Vector3::NEGATIVE_UNIT_Z.getRotationTo(targetPos - pos)); // Determine animation to be played according to outcome. Ogre::String ani; if (paradeResult >= RESULT_ERFOLG) { ani = "kampf_parade_erfolg"; } else { ani = "kampf_parade_misserfolg"; } // Get real animation name Creature::AnimationSpeedPair asp = getCreature()->getAnimation(ani); PlayAnimationJob* job = new PlayAnimationJob("Animation" + ani + getCreature()->getId(), getCreature()->getActor(), asp.first); job->setHoldOnEnd(false); jobSet->add(job); }
spatialRobocodeCreatureDelta::spatialRobocodeCreatureDelta() { participates = true; geneticAge = 0; int maxTree; bool done = false; thisCreatureDeltaNumber = CreatureDeltaIdentifierCount++; do { maxTree = randomint(8)+2; critter.reset(new cr_data); // makeptc2 is probabilistic tree creation method 2 - afaik the best way to create intial robots in ge critter->makeptc2(maxTree); done = critter->isValid(); } while (!done); isInvalid = false; //cout << "New valid spatialRobocodeCreatureDelta CreatureDelta created, with max size " << maxTree << "and id " << thisCreatureDeltaNumber << endl; char fname[200]; char jname[200]; char gname[200]; sprintf(gname,"Gen%d",currentGen); //cout << "Thinking of saving " << getName() << endl; if (!(getCreature()->isValid())) { cout << "Weird, newly created CreatureDelta is not valid\n"; exit(1); } sprintf(fname,"%s",getName()); sprintf(jname,"%s.java",fname); ofstream robotout; robotout.open(jname); robocodeDelta::Instance()->print_grammar_individual(robotout,getCreature()->getExpression(),getCreature()->getExpressionLength(),fname,gname); robotout.close(); }
void OnLoad() override { getCreature()->addUnitFlags(UNIT_FLAG_IGNORE_PLAYER_COMBAT); Player* pTarget = getNearestPlayer(); if (pTarget != nullptr) getCreature()->GetAIInterface()->AttackReaction(pTarget, 50, 0); }
void AIUpdate() override { if (_isTimerFinished(mSummonTimer)) { spawnCreature(SKELETON_ADD, getCreature()->GetPositionX() + 6, getCreature()->GetPositionY() + 4, getCreature()->GetPositionZ(), 0); spawnCreature(SKELETON_ADD, getCreature()->GetPositionX() - 6, getCreature()->GetPositionY() + 4, getCreature()->GetPositionZ(), 0); _resetTimer(mSummonTimer, 15000); } }
void OnDied(Unit* /*mKiller*/) override { if (getCreature()->m_escorter == NULL) return; Player* plr = getCreature()->m_escorter; getCreature()->m_escorter = NULL; auto quest_entry = plr->GetQuestLogForEntry(6523); if (quest_entry != nullptr) quest_entry->Fail(false); }
void OnReachWP(uint32 iWaypointId, bool /*bForwards*/) override { if (iWaypointId == 1) getCreature()->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "You follow me."); if (iWaypointId == 22) { getCreature()->DeleteWaypoints(); getCreature()->Despawn(500, 0); } }
void OnCombatStart(Unit* /*mTarget*/) override { if (!getCreature()->isCastingSpell()) { getCreature()->GetAIInterface()->StopMovement(1); getCreature()->setAttackTimer(MELEE, 3000); getCreature()->castSpell(getCreature(), arcaneVolley->mSpellInfo, true); } Blink = false; }
void MainWindow::addCreatureToWorld( ) { Creature* prv_creature = getSimulationThread().getSimulator().currentCreature(); if (prv_creature) { getSimulationThread().getSimulator().removeCreature(prv_creature); if (&getCreature() != prv_creature) { delete prv_creature; } } getSimulationThread().getSimulator().reset(); getSimulationThread().getSimulator().addCreature(&getCreature()); }
void AIUpdate() override { if (((getCreature()->getHealthPct() <= 75 && getScriptPhase() == 1) || (getCreature()->getHealthPct() <= 50 && getScriptPhase() == 2) || (getCreature()->getHealthPct() <= 25 && getScriptPhase() == 3))) { getCreature()->setAttackTimer(MELEE, 1500); getCreature()->GetAIInterface()->StopMovement(1000); // really? SummonElementalWave(); setScriptPhase(getScriptPhase() + 1); } }
explicit VaelastraszAI(Creature* pCreature) : CreatureAIScript(pCreature) { essenceOfTheRed = addAISpell(ESSENCE_OF_THE_RED, 0.0f, TARGET_VARIOUS); essenceOfTheRed->setAttackStopTimer(1000); auto flameBreath = addAISpell(FLAME_BREATH, 15.0f, TARGET_VARIOUS); flameBreath->setAttackStopTimer(3000); auto burningAdrenaline = addAISpell(BURNING_ADRENALINE, 3.0f, TARGET_ATTACKING); burningAdrenaline->setAttackStopTimer(2000); getCreature()->setHealth((uint32)(getCreature()->getMaxHealth() * 0.3f)); }
void AIUpdate() override { getCreature()->Emote(EMOTE_STATE_KNEEL); getCreature()->RemoveNegativeAuras(); getCreature()->SetFaction(12); getCreature()->SetHealthPct(100); getCreature()->GetAIInterface()->WipeTargetList(); getCreature()->GetAIInterface()->WipeHateList(); getCreature()->GetAIInterface()->HandleEvent(EVENT_LEAVECOMBAT, getCreature(), 0); _setMeleeDisabled(true); getCreature()->GetAIInterface()->SetAllowedToEnterCombat(false); getCreature()->removeUnitFlags(UNIT_FLAG_NOT_SELECTABLE); }
void OnDamageTaken(Unit* /*mAttacker*/, uint32 fAmount) override { // If Balos Jacken HP - fAmount < 20% if (getCreature()->getHealth() - fAmount <= getCreature()->getMaxHealth() * 0.2f) { //Missing: modify fAmount to prevent Balos Jacken death. //{...} //force player to loose target and stop melee auto-attack: getCreature()->addUnitFlags(UNIT_FLAG_NOT_SELECTABLE); //start AIUpdate RegisterAIUpdateEvent(1000); } }
explicit VHCreatureAI(Creature* pCreature) : CreatureAIScript(pCreature) { //this->CreateWaypoint(1, 0, 0, VH_DOOR_ATTACK_POSITION); //this->SetWaypointToMove(1); //this->MoveTo(VH_DOOR_ATTACK_POSITION.x, VH_DOOR_ATTACK_POSITION.y, VH_DOOR_ATTACK_POSITION.z, true); //_unit->GetAIInterface()->UpdateMove(); for (int i = 1; i < 3; ++i) { AddWaypoint(CreateWaypoint(i, 0, AttackerWP[i].wp_flag, AttackerWP[i].wp_location)); } getCreature()->GetAIInterface()->setWaypointScriptType(Movement::WP_MOVEMENT_SCRIPT_FORWARDTHENSTOP); getCreature()->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "I am alive!"); }
void AIUpdate() override { getCreature()->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Okay, okay! Enough fighting. No one else needs to get hurt."); getCreature()->RemoveNegativeAuras(); getCreature()->SetFaction(12); getCreature()->SetHealthPct(100); getCreature()->GetAIInterface()->WipeTargetList(); getCreature()->GetAIInterface()->WipeHateList(); getCreature()->GetAIInterface()->HandleEvent(EVENT_LEAVECOMBAT, getCreature(), 0); _setMeleeDisabled(true); getCreature()->GetAIInterface()->SetAllowedToEnterCombat(false); getCreature()->removeUnitFlags(UNIT_FLAG_NOT_SELECTABLE); RemoveAIUpdateEvent(); }
void AIUpdate() override { if ((getCreature()->getHealthPct() <= 66 && getScriptPhase() == 1) || (getCreature()->getHealthPct() <= 33 && getScriptPhase() == 1)) { SummonPhase(); setScriptPhase(getScriptPhase() + 1); } if (Banished) { getCreature()->RemoveAura(SP_ANZU_BANISH); Banished = false; } }
void AIUpdate() override { if (Blink) { getCreature()->GetAIInterface()->StopMovement(2000); getCreature()->setAttackTimer(MELEE, 6500); getCreature()->interruptSpell(); getCreature()->castSpell(getCreature(), arcaneExplosion->mSpellInfo, true); Blink = false; } }
void OnDied(Unit* mKiller) override { fulborgskilled++; if (mKiller->isPlayer()) { Player* mPlayer = static_cast<Player*>(mKiller); if (fulborgskilled > 8 && mPlayer->HasQuest(9667)) { getCreature()->GetMapMgr()->GetInterface()->SpawnCreature(17702, -2419, -12166, 33, 3.45f, true, false, 0, 0)->Despawn(18000000, 0); fulborgskilled = 0; getCreature()->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Chief, we need your help!"); } } }
void OnDamageTaken(Unit* mAttacker, uint32 fAmount) override { if (getCreature()->getHealth() - fAmount <= getCreature()->getMaxHealth() * 0.2f) { if (mAttacker->isPlayer()) { getCreature()->addUnitFlags(UNIT_FLAG_NOT_SELECTABLE); RegisterAIUpdateEvent(1000); QuestLogEntry* qle = (static_cast<Player*>(mAttacker))->GetQuestLogForEntry(1447); if (!qle) return; qle->SendQuestComplete(); } } }
//case for scriptPhase void AIUpdate() override { if (getCreature()->GetHealthPct() <= 40 && !mCalledForHelp) { sendDBChatMessage(4871); // Heal me, quickly! mCalledForHelp = true; } if (getCreature()->GetHealthPct() <= 20 && !_retaliation) { _retaliation = true; getCreature()->setAttackTimer(1500, false); _castAISpell(mRetaliation); } }
void Split() { CurrentHealth = getCreature()->getHealth(); _setDisplayId(24144); getCreature()->setHealth(240000); getCreature()->setMaxHealth(240000); mLynx = spawnCreature(CN_LYNX_SPIRIT, getCreature()->GetPosition()); if (mLynx) { mLynx->GetAIInterface()->AttackReaction(getCreature()->GetAIInterface()->getNextTarget(), 1); mLynx->m_noRespawn = true; } setScriptPhase(2); }
void OnCombatStart(Unit* /*pTarget*/) override { mTotemTimer = _addTimer(5000); // Just to make the Timer ID SplitCount = 1; MaxHealth = getCreature()->getMaxHealth(); mLynx = NULL; }
void AIUpdate() override { if (_isTimerFinished(mSummonTime)) { // Spawn 3 Soaring Eagles for (uint8 x = 0; x < 3; x++) { /*CreatureAIScript* Eagle =*/ spawnCreatureAndGetAIScript(CN_SOARING_EAGLE, (getCreature()->GetPositionX() + Util::getRandomFloat(12) - 10), (getCreature()->GetPositionY() + Util::getRandomFloat(12) - 15), getCreature()->GetPositionZ(), getCreature()->GetOrientation(), getCreature()->getFactionTemplate()); } sendChatMessage(CHAT_MSG_MONSTER_YELL, 12019, "Feed, me bruddahs!"); // Restart the timer _resetTimer(mSummonTime, 120000); } }
void AgentCombatState::requestCombatantAction() { // Think! Combat::CombatantSet opponents = mCombat->getAllOpponents(this); if (!opponents.empty()) { Combatant* target = findOpponent(opponents); mCombat->registerParade(target); if (getCreature()->getLe() <= 5) { mCombat->registerBewegen(this, getFleeTarget(opponents)); } else if (target) { // Are we in weapon range to opponent if (mCombat->canAttack(this, target)) { // Ok, we can attack mCombat->registerAttacke(this, target); } else { // We can't attack from here, so go to opponent. mCombat->registerFolgen(this, target); } } } mCombat->registerCombatantRoundDone(this); }
void MainWindow::setCreatureConstraintCount( int count ) { if (getCreature().getNumberOfConstraints() == count) { return; } // getCreature().setConstraintCount(count); // getCreature().setBodyCount(count + 1); }
void SummonElementalWave() { sendDBChatMessage(SAY_DARKW_SYNTH_01); getCreature()->castSpell(getCreature(), summonFireEle->mSpellInfo, true); getCreature()->castSpell(getCreature(), summonFrostEle->mSpellInfo, true); getCreature()->castSpell(getCreature(), summonArcaneEle->mSpellInfo, true); getCreature()->castSpell(getCreature(), summonShadowEle->mSpellInfo, true); }