VoidZoneARC(Creature* pCreature) : MoonScriptCreatureAI(pCreature) { StopMovement(); SetCanMove(false); SetCanEnterCombat(false); RegisterAIUpdateEvent(1000); }
void EnemyPunk::processUpdate() { // BelowFeetLadderCheck(); /* Stop All Directional Movement */ if(!ipFlags.S_ON_GROUND) ApplyGravity(); else if(ipFlags.S_DAMAGED) StopMovement(); /* Check for End of Death Animation */ if((player_spr->GetFrameSet() == ENEMY_PUNK_ANIM_DEATH) && !player_spr->IsAnimating()) Die(); /* Check for end of an attack state */ if(ipFlags.S_ATTACK) if((player_spr->GetFrameSet() == ENEMY_PUNK_ANIM_JUMP) && !player_spr->IsAnimating()) { SetAnimation(ENEMY_PUNK_ANIM_STAND, 0, true, false, 10, false); ipFlags.S_JUMP = false; ipFlags.S_ATTACK = false; } if(!ipFlags.S_DAMAGED && !ipFlags.S_ATTACK) switch(ipFlags.CurMState) { case move_stop: stop(); break; default: break; } //SetRectangle(rectWorldLoc, 25, 40, -nOffSet, -10); }
void EnemyPunk::processDeath() { /* Stop All Directional Movement */ StopMovement(); /* Set Death Animation */ SetAnimation(ENEMY_PUNK_ANIM_DEATH, 0, true, true, 10, true); }
void EnemyWolfGawain::processDeath() { /* Stop All Directional Movement */ StopMovement(); /* Set Death Animation */ SetAnimation(ENEMY_WOLF_DEATH, 0, true, true, 10, true); }
void EnemyJunkbotFlying::processDeath() { /* Stop All Directional Movement */ StopMovement(); /* Set Death Animation */ SetAnimation(ENEMY_JUNKBOT_FLYING_DEATH, 0, true, true, 10, true); }
void MoveToChest() { if (GetCanEnterCombat()) _unit->GetAIInterface()->SetAllowedToEnterCombat(false); StopMovement(); _unit->GetAIInterface()->SetAIState(STATE_SCRIPTMOVE); MoveTo(1.100060f, -780.026367f, 9.811194f); }
void EnemyGMonsterFire::stop() { /* Stop All Directional Movement */ StopMovement(); /* Set Frame 0 of Attack Animation */ if(ipFlags.PrevMState != move_stop) SetAnimation(ENEMY_FIRE_MONSTER_ATTACK, 0, false, false, 15, true); else SetAnimation(ENEMY_FIRE_MONSTER_ATTACK, 0, false, false, 15, false); }
void EnemyGMonsterFire::processDeath() { if (ipFlags.S_ACTIVE) soundPlayer->PlaySound(firedeath); /* Stop All Directional Movement */ StopMovement(); /* Set Death Animation */ SetAnimation(ENEMY_FIRE_MONSTER_DEATH, 0, true, true, 10, true); }
void EnemyWolfGawain::processDamage() { ipFlags.S_ATTACK = false; HIT = true; /* Stop All Directional Movement */ StopMovement(); SetAnimation(ENEMY_WOLF_DEATH, 0, true, true, 10, true); }
void AZanshinAIController::BeginInactiveState() { Super::BeginInactiveState(); StopMovement(); AGameState* GameState = GetWorld()->GameState; const float MinRespawnDelay = (GameState && GameState->GameModeClass) ? GetDefault<AGameMode>(GameState->GameModeClass)->MinRespawnDelay : 1.0f; GetWorldTimerManager().SetTimer(TimerHandle_Respawn, this, &AZanshinAIController::Respawn, MinRespawnDelay); }
void AIInterface::CastFuckingAISpell(Unit* Target, AI_Spell* toCast, uint32 currentTime) { if(m_CastNext == toCast) { m_CastNext = NULL; SetBehaviorType(Behavior_Default); } if(Target == NULL) return; if(toCast->ProcLimit) toCast->procCounter++; if(toCast->info->IsChannelSpell()) { m_CastTimer = 1000; int32 duration = GetSpellInfoDuration(toCast->info, m_Unit, Target); if(duration > 0) m_CastTimer += duration; } else m_CastTimer = 1000+toCast->casttime; toCast->lastcast = currentTime; if(toCast->attackstoptimer) m_Unit->setAttackTimer(m_CastTimer+toCast->attackstoptimer, false); StopMovement(m_CastTimer); m_AIState = STATE_CASTING; toCast->mPredefinedTarget = NULL; switch(toCast->TargetType) { case TargetGen_Self: case TargetGen_Current: case TargetGen_Predefined: case TargetGen_RandomUnit: case TargetGen_RandomPlayer: case TargetGen_ManaClass: m_Unit->CastSpell(Target, toCast->info, false, toCast->casttime); break; case TargetGen_RandomUnitApplyAura: case TargetGen_RandomPlayerApplyAura: Target->CastSpell(Target, toCast->info, false, toCast->casttime); break; case TargetGen_Destination: case TargetGen_RandomUnitDestination: case TargetGen_RandomPlayerDestination: m_Unit->CastSpellAoF(Target->GetPositionX(), Target->GetPositionY(), Target->GetPositionZ(), toCast->info, false, toCast->casttime); break; } }
void ARealmMoveController::GameEnded() { StopMovement(); GetWorldTimerManager().ClearAllTimersForObject(this); AGameCharacter* gc = Cast<AGameCharacter>(GetCharacter()); if (IsValid(gc)) { gc->StopAutoAttack(); gc->GetCharacterMovement()->SetMovementMode(MOVE_None); } }
void ArcScriptCreatureAI::PopRunToTargetCache() { if( mRunToTargetCache ) { mRunToTargetCache = NULL; mRunToTargetSpellCache = NULL; SetAllowMelee(true); SetAllowRanged(true); SetAllowSpell(true); StopMovement(); } }
void MoonScriptCreatureAI::ForceWaypointMove(uint32 pWaypointId) { if (GetCanEnterCombat()) _unit->GetAIInterface()->SetAllowedToEnterCombat(false); if (!GetCanMove()) SetCanMove(true); StopMovement(); _unit->GetAIInterface()->SetAIState(STATE_SCRIPTMOVE); SetMoveType(Move_WantedWP); SetWaypointToMove(pWaypointId); }
void EnemyPunk::processDamage() { if (ipFlags.S_ACTIVE) m_soundFXDamage->Play(); //if (ipFlags.S_ACTIVE) soundPlayer->PlaySound(damage00); ipFlags.S_ATTACK = false; velYModifier = -80; StopMovement(); if(ipFlags.S_DAMAGED_DIRECTION) velMovement = 200; else velMovement = -200; }
void OnLoad() { HandOfTheDeceiver1 = _unit->GetMapMgr()->GetInterface()->SpawnCreature(CN_HAND_OF_THE_DECEIVER, 1678.00f, 610.00f, 28.00f, 0.00f, true, false, 0, 0); HandOfTheDeceiver2 = _unit->GetMapMgr()->GetInterface()->SpawnCreature(CN_HAND_OF_THE_DECEIVER, 1712.00f, 604.00f, 28.00f, 0.00f, true, false, 0, 0); HandOfTheDeceiver3 = _unit->GetMapMgr()->GetInterface()->SpawnCreature(CN_HAND_OF_THE_DECEIVER, 1684.00f, 651.00f, 28.00f, 0.00f, true, false, 0, 0); HandOfTheDeceiver4 = _unit->GetMapMgr()->GetInterface()->SpawnCreature(CN_HAND_OF_THE_DECEIVER, 1720.00f, 642.00f, 28.00f, 0.00f, true, false, 0, 0); _unit->SetUInt64Value(UNIT_FIELD_FLAGS, ( false ) ? 0 : UNIT_FLAG_NOT_ATTACKABLE_9); _unit->GetAIInterface()->SetAllowedToEnterCombat(false); SetCanMove(false); ShShadowbolt = dbcSpell.LookupEntry(SHIELD_ORB_SHADOWBOLT); Darkness_explosion = dbcSpell.LookupEntry(29973); Darkness = dbcSpell.LookupEntry(DARKNESS_OF_A_THOUSAND_SOULS); ApplyAura(46367); ApplyAura(46410); StopMovement(); ParentClass::OnLoad(); }
// Event when controlled pawn has died void AMurphysLawAIController::OnKilled(const float TimeToRespawn) { // Disable movement task branch from BT and current Move task SetBlackboardCanMove(false); StopMovement(); SetBlackboardTarget(nullptr); // Stop looking at target // Note : Calling ClearFocus changes the current rotation. // Saving the rotation avoid instant turn upon death const FRotator CurrentRotation = GetPawn()->GetActorRotation(); ClearFocus(EAIFocusPriority::Gameplay); ClearFocus(EAIFocusPriority::Default); ClearFocus(EAIFocusPriority::LastFocusPriority); ClearFocus(EAIFocusPriority::Move); GetPawn()->SetActorRotation(CurrentRotation); // Respawn logic MyCharacter = Cast<AMurphysLawCharacter>(this->GetPawn()); UnPossess(); GetWorldTimerManager().SetTimer(TimerHandle_Respawn, this, &AMurphysLawAIController::Respawn, TimeToRespawn); }
void EnemyPunk::processAttack() { if(!ipFlags.S_ATTACK && !ipFlags.S_DAMAGED && !ipFlags.S_DEAD) { ipFlags.S_ATTACK = true; switch(ipFlags.nCurrAttack) { case 0: // if (ipFlags.S_ACTIVE) soundPlayer->PlaySound(jump00); StopMovement(); if(ipFlags.S_DIRECTION) velModifier = 200; else velModifier = -200; velYModifier = 0; velYJumpModifier = jumpMaxVelocity; SetAnimation(ENEMY_PUNK_ANIM_JUMP, 0, true, true, 15, false); ipFlags.S_ATTACK = true; break; case 1: // if (ipFlags.S_ACTIVE) soundPlayer->PlaySound(jump00); /* Up and Down */ velYModifier = 0; velYJumpModifier = jumpMaxVelocity * 2; SetAnimation(ENEMY_PUNK_ANIM_JUMP, 0, true, true, 15, false); ipFlags.S_ATTACK = true; break; case 2: // if (ipFlags.S_ACTIVE) soundPlayer->PlaySound(jump00); /* Attack Jump */ StopMovement(); velYModifier = 0; velYJumpModifier = jumpMaxVelocity; SetAnimation(ENEMY_PUNK_ANIM_JUMP, 0, true, true, 15, false); ipFlags.S_ATTACK = true; break; default: ipFlags.S_ATTACK = false; break; } } }
void AiAgentHealSupport::Update(uint32 p_time) { _UpdateTimer(p_time); _UpdateMovement(p_time); if( !m_PetOwner ) return; //oh noez, our master has abandoned us ! Where is te luv ? //we used this spell to create healbot. To avoid logout / login recreate we need to remove aura // lol, this will never work :( if( !m_Unit->isAlive() ) m_PetOwner->RemoveAura( 36765 ); if( m_Unit->GetMapMgr() != m_PetOwner->GetMapMgr() ) { m_PetOwner->RemoveAura( 36765 ); m_Unit->EventSummonPetExpire(); } if( m_Unit->isCasting() ) return; // we are already supporting someone ...get back later //we should be at same level at owner so we profit of fighting formulas same as owner if( m_Unit->GetUInt32Value( UNIT_FIELD_LEVEL ) != m_PetOwner->GetUInt32Value( UNIT_FIELD_LEVEL ) ) { m_Unit->SetUInt32Value( UNIT_FIELD_LEVEL, m_PetOwner->GetUInt32Value( UNIT_FIELD_LEVEL ) ); DifficultyLevel = m_PetOwner->GetUInt32Value( UNIT_FIELD_LEVEL ) / 80.0f; //printf("difficulty changed to %f \n",DifficultyLevel); //scale health and mana.when we level we max out our stats m_Unit->SetUInt32Value( UNIT_FIELD_MAXHEALTH , (uint32)(m_Unit->GetUInt32Value( UNIT_FIELD_BASE_HEALTH ) * ( 1 + DifficultyLevel ) * CREATURE_STATS_SCALE_WITH_DIFFICULTY) ); m_Unit->SetUInt32Value( UNIT_FIELD_MAXPOWER1 , (uint32)(m_Unit->GetUInt32Value( UNIT_FIELD_BASE_MANA ) * ( 1 + DifficultyLevel ) * CREATURE_STATS_SCALE_WITH_DIFFICULTY) ); m_Unit->SetUInt32Value( UNIT_FIELD_HEALTH , (uint32)(m_Unit->GetUInt32Value( UNIT_FIELD_HEALTH ) * ( 1 + DifficultyLevel ) * CREATURE_STATS_SCALE_WITH_DIFFICULTY) ); m_Unit->SetUInt32Value( UNIT_FIELD_POWER1 , (uint32)(m_Unit->GetUInt32Value( UNIT_FIELD_POWER1 ) * ( 1 + DifficultyLevel ) * CREATURE_STATS_SCALE_WITH_DIFFICULTY) ); } //if owner fights a long combat then we he desrvers to get lasy at the end ? if( m_PetOwner->CombatStatus.IsInCombat() ) CombatDifficultyLevel += DIFFICULTY_UPDATE_SPEED; else CombatDifficultyLevel = 0; if( CombatDifficultyLevel > 1 ) CombatDifficultyLevel = 1; uint32 Time_Now = getMSTime(); std::list<healagentspell*>::iterator itr; SpellCastTargets targets( m_PetOwner->GetGUID() ); healagentspell *m_castingSpell = NULL; Unit *SpellTarget = m_PetOwner; //poor thing died. Res him. //will never work if( !m_PetOwner->isAlive() && CheckCanCast( revive_spell.sp, SpellTarget ) ) { m_castingSpell = &revive_spell; //printf("master died, we are going to resurect him\n"); } //if we are injusred we should try to survive it if ( m_castingSpell== NULL && m_Unit->GetUInt32Value( UNIT_FIELD_HEALTH ) < m_Unit->GetUInt32Value( UNIT_FIELD_MAXHEALTH ) ) { //printf("we are injured, diff is %u \n",m_Unit->GetUInt32Value( UNIT_FIELD_MAXHEALTH ) - m_Unit->GetUInt32Value( UNIT_FIELD_HEALTH )); if( !Protect_self() ) //first we try to escape combat { m_castingSpell = PickSpellFromList( &m_healspells, m_Unit ); SpellTarget = m_Unit; } else { m_castingSpell = &m_defend_self; SpellTarget = m_Unit; } } //select an augment spell if we have nothing better to do if( m_castingSpell== NULL && m_PetOwner->GetUInt32Value( UNIT_FIELD_HEALTH ) == m_PetOwner->GetUInt32Value( UNIT_FIELD_MAXHEALTH ) ) { //printf("master is ok, we can try augment someone\n"); m_castingSpell = PickSpellFromList( &m_AugmentSelf, m_Unit ); //try augment owner ? if( !m_castingSpell ) { m_castingSpell = PickSpellFromList( &m_AugmentTarget, m_PetOwner ); SpellTarget = m_Unit; } } //master is injured, this should be most common case if( m_castingSpell==NULL && m_PetOwner->GetUInt32Value( UNIT_FIELD_HEALTH ) < m_PetOwner->GetUInt32Value( UNIT_FIELD_MAXHEALTH ) ) { //printf("master is injured, will try to heal him\n"); m_castingSpell = PickSpellFromList( &m_healspells , m_PetOwner); SpellTarget = m_PetOwner; } if( m_castingSpell ) { //printf("we have a spell to cast\n"); SpellCastTime *sd = dbcSpellCastTime.LookupEntry( m_castingSpell->sp->CastingTimeIndex ); //do not stop for instant casts if(GetCastTime(sd) != 0) { StopMovement(0); //printf("spell is not instant so we are going to stop movement \n"); } float distance = m_Unit->GetDistanceSq( SpellTarget ); if( distance <= m_castingSpell->sp->base_range_or_radius_sqr || m_castingSpell->sp->base_range_or_radius_sqr == 0 ) { //printf("we are in range and going to cast spell \n"); m_AIState = STATE_CASTING; Spell *nspell = SpellPool.PooledNew(); nspell->Init(m_Unit, m_castingSpell->sp, false, NULL); #ifdef SPELL_EFF_PCT_SCALE_WITH_DIFFICULTY if( m_castingSpell->max_scale ) { nspell->forced_basepoints[ 0 ] = (uint32)( m_castingSpell->max_scale * ( DifficultyLevel + CombatDifficultyLevel) ); if( nspell->forced_basepoints[ 0 ] > m_castingSpell->max_scale * 2) nspell->forced_basepoints[ 0 ] = m_castingSpell->max_scale * 2; } #endif targets.m_unitTarget = SpellTarget->GetGUID(); nspell->prepare( &targets ); CastSpell( m_Unit, m_castingSpell->sp, targets ); SetSpellDuration( m_castingSpell ); //mana regen is to big, he can cast forever, double mana usage maybe regulates this m_Unit->ModSignedInt32Value( UNIT_FIELD_POWER1, -m_castingSpell->sp->manaCost ); } else // Target out of Range -> Run to it { //printf("we are going to move closer \n"); m_moveRun = true; _CalcDestinationAndMove( SpellTarget, sqrt( m_castingSpell->sp->base_range_or_radius_sqr ) ); } } // check if pets regenrate mana, If not then we should implement that too //if owner is mounted then we mount too. Speed is not set though if( m_PetOwner->GetUInt32Value( UNIT_FIELD_MOUNTDISPLAYID ) && m_Unit->GetUInt32Value( UNIT_FIELD_MOUNTDISPLAYID ) == 0 ) { if( Owner_side == OWNER_SIDE_ALIANCE ) m_Unit->SetUInt32Value( UNIT_FIELD_MOUNTDISPLAYID, HELPER_MOUNT_A_DISPLAY ); else m_Unit->SetUInt32Value( UNIT_FIELD_MOUNTDISPLAYID, OWNER_SIDE_HORDE ); m_moveSprint = true; } else if( m_PetOwner->GetUInt32Value( UNIT_FIELD_MOUNTDISPLAYID ) == 0 && m_Unit->GetUInt32Value( UNIT_FIELD_MOUNTDISPLAYID ) != 0 ) { m_Unit->SetUInt32Value( UNIT_FIELD_MOUNTDISPLAYID, 0 ); m_moveSprint = false; } //for fun : mimic master standstate. Note that this might give strange results if( m_PetOwner->GetStandState() != m_Unit->GetStandState() ) m_Unit->SetStandState( m_PetOwner->GetStandState() ); if( m_castingSpell == NULL ) { if( First_noaction_stamp == 0 ) First_noaction_stamp = Time_Now; float dist = m_Unit->CalcDistance( m_PetOwner ); //printf("we are far from owner, we should move closer , dist %f from %f \n",dist,(FollowDistance*FollowDistance)); if ( dist > FollowDistance ) //if out of range { m_moveRun = true; if(dist > 20.0f) m_moveSprint = true; float delta_x = UnitToFollow->GetPositionX(); float delta_y = UnitToFollow->GetPositionY(); float d = 3; MoveTo(delta_x+(d*(cosf(m_fallowAngle+m_PetOwner->GetOrientation()))), delta_y+(d*(sinf(m_fallowAngle+m_PetOwner->GetOrientation()))), m_PetOwner->GetPositionZ(),m_PetOwner->GetOrientation()); } } else if(m_castingSpell != NULL ) First_noaction_stamp = 0; //if( First_noaction_stamp )printf("ms to say something %u and ms for say cooldown %u\n",First_noaction_stamp + BOREDOM_TIMER_TO_START_TRIGGERING - Time_Now,Boredom_cooldown - Time_Now ); if( First_noaction_stamp && First_noaction_stamp + BOREDOM_TIMER_TO_START_TRIGGERING < Time_Now && Boredom_cooldown < Time_Now ) { //some chance to say something if( Rand( 50 ) ) m_Unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, bored_texts[ RandomUInt( BOREDOM_TEXTCOUNT ) ]); else m_Unit->SetUInt32Value ( UNIT_NPC_EMOTESTATE, bored_emotes[ RandomUInt( BOREDOM_EMOTECOUNT ) ] ); Boredom_cooldown = Time_Now + BOREDOM_TRIGGER_INTERVAL; } }
void EnemyJunkbotFlying::stop() { StopMovement(); }
/// Time passed in seconds..! void PongPlayerProperty::Process(int timeInMs) { List<Entity*> entities = MapMan.GetEntities(); Time now = Time::Now(); int secondsSinceLastInput = (now - lastUserInput).Seconds(); if (secondsSinceLastInput < 1) { StopMovement(); return; } bool moved = false; Entity * closestBall = 0; float closestDistance = 1000000.f; /// Check distance to ball. Fetch closest/most dangerous one! for (int i = 0; i < entities.Size(); ++i) { Entity * ball = entities[i]; if (!ball->physics) continue; PongBallProperty * pbp = (PongBallProperty*) ball->GetProperty("PongBallProperty"); if (!pbp) continue; if (pbp->sleeping) continue; // Check distance. Vector3f ballToPaddle = owner->position - ball->position; // Ignore balls going away. if (ball->physics->velocity.DotProduct(lookAt) > 0) continue; float distance = AbsoluteValue(ballToPaddle[0]); if (!ball->physics) continue; if (distance > 500.f) continue; if (distance < closestDistance) { closestBall = ball; closestDistance = distance; } } if (closestBall) { /// Ball on the wya here?! if (lookAt.DotProduct(closestBall->physics->velocity) < 0) { // Head towards it! Vector3f ballToPaddle = owner->position - closestBall->position; Vector3f toMove = -ballToPaddle; toMove.Normalize(); toMove *= aiSpeed; toMove[1] += closestBall->physics->velocity[1] * 0.5f; toMove[0] = toMove[2] = 0; Physics.QueueMessage(new PMSetEntity(owner, PT_VELOCITY, Vector3f(toMove))); moved = true; } } if (!moved) StopMovement(); }