Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /***********************
- * Scripted by Jinung
- * for Shindo'Rei
- * Core 4.0.6
- *
- * Salles des Origines
- * Boss - RAJH
- *
- ***********************/
- #include"ScriptPCH.h"
- #include"WorldPacket.h"
- #include"halls_of_origination.h"
- #include"ScriptMgr.h"
- #include"ScriptedCreature.h"
- #include"SpellScript.h"
- #include"SpellAuraEffects.h"
- enum Spells
- {
- Coupdesoleil = 73872,
- Bonddufeu = 87653,
- Ventsolaires = 89130,
- Feusolaire = 89131,
- Benediction = 76355,
- Invocorb = 76338,
- Berz = 26662,
- Bond = 82856,
- Chanorb = 80352,
- Indicateur = 82643,
- SPELL_AURA_spell_Dotsoleil = 44444, //Id pour l'appeler?
- SPELL_AURA_spell_BumpnDamage = 44445, //Id pour l'appeler?
- };
- enum NPC
- {
- mobs_ventsolaire = 47922,
- mobs_orbsoleil = 40835,
- mobs_flames = 888888, //id????
- mobs_indic = 999999, //id????
- };
- class Rajh : public CreatureScript
- {
- public:
- Rajh() : CreatureScript("Rajh"){}
- CreatureAI* GetAI(Creature* pCreature) const
- {
- return new RajhAI(pCreature);
- }
- struct RajhAI : public ScriptedAI
- {
- //imperatif a chaque boss
- RajhAI(Creature* pCreature) : ScriptedAI(pCreature)
- {
- pMap = me->GetMap();
- pInstance = pCreature->GetInstanceScript();
- }
- InstanceScript *pInstance;
- bool check_in;
- Map* pMap;
- uint32 Coupdesoleil_timer;
- uint32 Bonddufeu_timer;
- uint32 Ventsolaires_timer;
- uint32 Chanorb_timer;
- uint32 Power;
- uint32 Berz_timer;
- //Fonction Reset
- void Reset()
- {
- // les DATA sont dans le .h de l'instance
- if (pInstance && (pInstance->GetData(DATA_RAJH_EVENT) != DONE && !check_in))
- pInstance->SetData(DATA_RAJH, NOT_STARTED);
- check_in = false;
- //CR Sheero
- if (IsHeroic())
- me->SetHealth(5137000);
- //Fin CR
- Coupdesoleil_timer = 8000; //CD non blizz (à vérifier)
- Bonddufeu_timer = 15000;
- Ventsolaires_timer = 10000;
- Chanorb_timer = 10000;
- Berz_timer = 480000;
- Power = 100;
- me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_STUN, true); //Prot
- me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true); //Prot
- }
- void KilledUnit(Unit* /*Killed*/)
- {
- switch(urand(0,1))
- {
- case 0:me->MonsterYell("Je prends cette vie en guise d'offrande !",LANG_UNIVERSAL,NULL);
- break;
- case 1:me->MonsterYell("Je vous renvoie à vos dieux.",LANG_UNIVERSAL,NULL);
- break;
- }
- }
- void JustDied(Unit* /*Kill*/)
- {
- switch(urand(1,1000))
- {
- default:me->MonsterYell("Lumière étincelante… Emporte-moi.",LANG_UNIVERSAL,NULL);
- break;
- case 666:me->MonsterYell("Jinung est-ce toi?",LANG_UNIVERSAL,NULL);
- break;
- }
- if (pInstance)
- pInstance->SetData(DATA_RAJH_EVENT, DONE);
- //CR Sheero
- if (IsHeroic())
- {
- AchievementEntry const *AchievHero = GetAchievementStore()->LookupEntry(5065);
- if (AchievHero)
- {
- if (pMap && pMap->IsDungeon())
- {
- Map::PlayerList const &players = pMap->GetPlayers();
- for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
- itr->getSource()->CompletedAchievement(AchievHero);
- }
- }
- }
- AchievementEntry const *Achiev = GetAchievementStore()->LookupEntry(4841);
- if (Achiev)
- {
- if (pMap && pMap->IsDungeon())
- {
- Map::PlayerList const &players = pMap->GetPlayers();
- for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
- itr->getSource()->CompletedAchievement(Achiev);
- }
- }
- //Fin CR
- }
- void EnterCombat(Unit* /*Ent*/)
- {
- me->MonsterYell("Profanateurs ! Misérables ! Monstres ! Sortez d'ici !",LANG_UNIVERSAL,NULL);
- if (pInstance)
- pInstance->SetData(DATA_RAJH_EVENT, IN_PROGRESS);
- DoZoneInCombat();
- }
- //Fonction Update
- void UpdateAI(const uint32 uiDiff)
- {
- if (!UpdateVictim())
- return;
- //Coupdesoeil
- if(Coupdesoleil_timer <= uiDiff)
- {
- DoCastAOE(Coupdesoleil,true);
- Unit * ptarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 50, true);
- if(IsHeroic())
- {
- Map::PlayerList const &players = pMap->GetPlayers();
- for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
- if(me->IsWithinDistInMap(itr->getSource(), 50.0f))
- {
- me->DealDamage(itr->getSource(),urand(3237, 3762));
- DoCast(me->getVictim(), SPELL_AURA_spell_Dotsoleil ,true);
- }
- }
- else
- {
- Map::PlayerList const &players = pMap->GetPlayers();
- for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
- if(me->IsWithinDistInMap(itr->getSource(), 50.0f))
- {
- me->DealDamage(itr->getSource(),urand(14137, 15862));
- DoCast(me->getVictim(), SPELL_AURA_spell_Dotsoleil ,true);
- }
- }
- me->ModifyPower(me->GetPower(POWER_MANA) - 20);
- }
- else
- Coupdesoleil_timer -= uiDiff;
- //Bonddufeu
- if(Bonddufeu_timer <= uiDiff)
- {
- Unit *ptarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 250, true);
- me->CastSpell(ptarget, Bonddufeu, true); //Channel 1.5s sans saut
- me->SummonCreature(mobs_indic, ptarget); //// Spell qui met un indicateur sur la personne qui va se faire cibléparer le Bond
- me->GetMotionMaster()->MovePoint(uint32, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+ 5.0f); //Eleve de 5m vers le haut
- me->DoCast(ptarget, Bond, true);
- me->ModifyPower(me->GetPower(POWER_MANA) - 20);
- }
- else
- Bonddufeu_timer -= uiDiff;
- //Ventsolaires
- if(Ventsolaires_timer <= uiDiff)
- {
- me->SummonCreature(mobs_ventsolaire, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(),1.0f); //Cast devant soit
- me->ModifyPower(me->GetPower(POWER_MANA) - 20);
- }
- else
- Ventsolaires_timer -= uiDiff;
- //Orb du soleil
- if(Chanorb_timer <= uiDiff)
- {
- Unit *ptarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 5000, true);
- for(int i=0; i<=1500; i++) //temps d'attente = 1.5s (remplace le channeling)
- {
- //nothing
- }
- me->SummonCreature(mobs_orbsoleil, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() + 20.0f,1.0f);
- me->ModifyPower(me->GetPower(POWER_MANA) - 20);
- }
- //Bénédiction du Soleil
- if(me->GetPower(POWER_MANA) <= 10)
- {
- me->GetMotionMaster()->MovePoint(uint32, -319.596161, 193.420105, 342.945282); //Milieu salle
- me->MonsterYell("Sentez-vous cette caresse ? La chaleur bénie du soleil … ?",LANG_UNIVERSAL,NULL);
- for(int i = 0 ; i <= 20; i++)
- {
- DoCastAOE(Benediction, true);
- if(IsHeroic())
- {
- Map::PlayerList const &players = pMap->GetPlayers();
- for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
- me->DealDamage(itr->getSource(),urand(4162, 4837));
- me->ModifyPower(me->GetPower(POWER_MANA) + 5);
- }
- else
- {
- Map::PlayerList const &players = pMap->GetPlayers();
- for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
- me->DealDamage(itr->getSource(),urand(3237, 3762));
- me->ModifyPower(me->GetPower(POWER_MANA) + 5);
- }
- }
- }
- if(Berz_timer <= uiDiff)
- {
- DoCast(me, Berz);
- }
- else
- Berz_timer -= uiDiff;
- DoMeleeAttackIfReady();
- }
- };
- };
- class mobs_vents_solaires : public CreatureScript
- {
- public:
- mobs_vents_solaires() : CreatureScript("mobs_vents_solaires") { }
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mobs_vents_solairesAI (creature);
- }
- struct mobs_vents_solairesAI : public ScriptedAI
- {
- mobs_vents_solairesAI(Creature* creature) : ScriptedAI(creature) { }
- uint32 uiCheckDistanceTimer;
- uint32 Feusolaire_timer;
- uint32 Spawn_timer;
- void Reset()
- {
- uiCheckDistanceTimer = 2*IN_MILLISECONDS;
- Feusolaire_timer = 1500; // A ajuster en fct° de la vitesse des tornades
- Spawn_timer = 20000;
- }
- void EnterCombat(Unit* /*pWho*/) { }
- void JustDied(Unit* /*Killer*/) {}
- void UpdateAI(const uint32 Diff)
- {
- if (!UpdateVictim())
- return;
- Unit *ptarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 5000, true);
- me->GetMotionMaster()->MoveChase(ptarget);
- if (me->IsWithinDistInMap(ptarget, 2.0f))
- {
- if (uiCheckDistanceTimer <= Diff)
- {
- me->CastSpell(ptarget, SPELL_AURA_spell_BumpnDamage, true);
- uiCheckDistanceTimer = 86400*IN_MILLISECONDS;
- }
- else uiCheckDistanceTimer -= Diff;
- }
- if(Feusolaire_timer <= Diff)
- {
- me->SummonCreature(mobs_flames, me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),1.0f); //crée mobs_flames sur soi
- }
- else Feusolaire_timer -= Diff;
- if(Spawn_timer <= Diff)
- {
- me->DespawnOrUnsummon();
- }
- //Do not attack
- }
- };
- };
- class mobs_orbdusoleil : public CreatureScript
- {
- public:
- mobs_orb_dusoleil() : CreatureScript("mobs_orbdusoleil") { }
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mobs_orbdusoleilAI (creature);
- }
- struct mobs_orb_dusoleilAI : public ScriptedAI
- {
- mobs_orbdusoleilAI(Creature* creature) : ScriptedAI(creature) { }
- uint32 attente;
- Position *PosTar;
- Map *pMap;
- void Reset()
- {
- attente = 1000;
- }
- void EnterCombat(Unit* /*pWho*/) { }
- void JustDied(Unit* /*Killer*/) {}
- void UpdateAI(const uint32 Diff)
- {
- if (!UpdateVictim())
- return;
- if(attente <= Diff)
- {
- Unit *ptarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 5000, true);
- if (ptarget && ptarget->isAlive())
- {
- ptarget->GetPosition(PosTar);
- me->SetOrientation(me->GetAngle(ptarget));
- me->GetNearPosition(*PosTar, 10.0f, 0.0f);
- }
- if(ptarget->GetPositionX(), ptarget->GetPositionY(), ptarget->GetPositionZ())
- {
- Map::PlayerList const &players = pMap->GetPlayers();
- for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
- if(me->IsWithinDistInMap(itr->getSource(), 10.0f))
- {
- me->DealDamage(itr->getSource(),urand(18500, 21500));
- }
- }
- me->DespawnOrUnsummon();
- }
- //Do not attack
- }
- };
- };
- class mobs_flamesvent : public CreatureScript
- {
- public:
- mobs_flamesvent() : CreatureScript("mobs_flamesvent") { }
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mobs_flamesventAI (creature);
- }
- struct mobs_flamesventAI : public ScriptedAI
- {
- mobs_flamesventAI(Creature* creature) : ScriptedAI(creature) { }
- uint32 Feusolaire_timer;
- uint32 Spawn_timer;
- void Reset()
- {
- Feusolaire_timer = 1420;
- Spawn_timer = 7100;
- }
- void EnterCombat(Unit* /*pWho*/) { }
- void JustDied(Unit* /*Killer*/) {}
- void UpdateAI(const uint32 Diff)
- {
- if (!UpdateVictim())
- return;
- if(Feusolaire_timer <= Diff)
- {
- DoCast(me, Feusolaire);
- }
- else Feusolaire_timer -= Diff;
- if(Spawn_timer <= Diff)
- {
- me->DespawnOrUnsummon();
- }
- //Do not attack
- }
- };
- };
- class mobs_indicateur : public CreatureScript
- {
- public:
- mobs_indicateur() : CreatureScript("mobs_indicateur") { }
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mobs_indicateurAI (creature);
- }
- struct mobs_indicateurAI : public ScriptedAI
- {
- mobs_indicateurAI(Creature* creature) : ScriptedAI(creature) { }
- uint32 Indicateur_timer;
- uint32 Spawn_timer;
- void Reset()
- {
- Indicateur_timer = 500;
- Spawn_timer = 900;
- }
- void EnterCombat(Unit* /*pWho*/) { }
- void JustDied(Unit* /*Killer*/) {}
- void UpdateAI(const uint32 Diff)
- {
- if (!UpdateVictim())
- return;
- if(Indicateur_timer <= Diff)
- {
- DoCast(me, Indicateur);
- }
- else Indicateur_timer -= Diff;
- if(Spawn_timer <= Diff)
- {
- me->DespawnOrUnsummon();
- }
- //Do not attack
- }
- };
- };
- class spell_BumpnDamage : public SpellScriptLoader
- {
- public:
- spell_BumpnDamage() : SpellScriptLoader("spell_BumpnDamage") { }
- class spell_BumpnDamage_AuraScript : public AuraScript
- {
- PrepareAuraScript(spell_BumpnDamage_AuraScript)
- enum Spells
- {
- // SPELL_X = ,
- };
- bool Load()
- {
- //Si caster = player, ne s'active pas.
- if (Unit * caster = GetCaster())
- if (caster->GetTypeId() == TYPEID_PLAYER)
- return false;
- return true;
- }
- //void Unload(){}
- void HandleEffectApply(AuraEffect const * /*aurEff*/, AuraEffectHandleModes /*mode*/)
- {
- Unit * caster = GetCaster();
- sLog->outString("Aura Effect is about to be applied on target!");
- Unit *target = caster->SelectNearbyTarget(5.0f);
- target->DealDamage(target, urand(9620, 11180));
- target->KnockbackFrom(caster->GetPositionX(), caster->GetPositionY(), 5.0, 2.0); //Speed à régler 5.0 = xy ; 2.0 = z
- }
- void Register()
- {
- OnEffectApply += AuraEffectApplyFn(spell_BumpnDamage_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
- }
- };
- AuraScript *GetAuraScript() const
- {
- return new spell_BumpnDamage_AuraScript();
- }
- };
- class spell_Dotsoleil : public SpellScriptLoader
- {
- public:
- spell_Dotsoleil() : SpellScriptLoader("spell_Dotsoleil") { }
- class spell_Dotsoleil_AuraScript : public AuraScript
- {
- PrepareAuraScript(spell_Dotsoleil_AuraScript)
- enum Spells
- {
- };
- bool Load()
- {
- //Si caster = player, ne s'active pas.
- if (Unit * caster = GetCaster())
- if (caster->GetTypeId() == TYPEID_PLAYER)
- return false;
- return true;
- }
- //void Unload(){}
- void HandleEffectCalcAmount(AuraEffect const * /*aurEff*/, int32 & amount, bool & canBeRecalculated)
- {
- sLog->outString("Amount of Aura Effect is being calculated now!");
- // we're setting amount to 5
- amount = 5;
- // amount will be never recalculated due to applying passive aura
- canBeRecalculated = false;
- }
- void HandleEffectCalcPeriodic(AuraEffect const * /*aurEff*/, bool & isPeriodic, int32 & amplitude)
- {
- sLog->outString("Periodic data of Aura Effect is being calculated now!");
- // we're setting aura to be periodic and tick every 3 seconds
- isPeriodic = true;
- amplitude = 3 * IN_MILLISECONDS;
- }
- void HandleEffectPeriodic(AuraEffect const * /*aurEff*/)
- {
- Map *pMap;
- if(pMap->IsHeroic())
- {
- sLog->outString("Perioidic Aura Effect IF_HEROIC_DJ is does a tick on target!");
- Unit * target = GetTarget();
- // aura targets damage self on tick
- target->DealDamage(target, urand(7500 , 8500));
- return;
- }
- Unit * target = GetTarget();
- // aura targets damage self on tick
- target->DealDamage(target, urand(4687, 5312));
- }
- void Register()
- {
- OnEffectPeriodic += AuraEffectPeriodicFn(spell_Dotsoleil_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_DUMMY);
- DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_Dotsoleil_AuraScript::HandleEffectCalcAmount, EFFECT_0, SPELL_AURA_DUMMY);
- DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_Dotsoleil_AuraScript::HandleEffectCalcPeriodic, EFFECT_0, SPELL_AURA_DUMMY);
- }
- };
- AuraScript *GetAuraScript() const
- {
- return new spell_Dotsoleil_AuraScript();
- }
- };
- void AddSC_Rajh()
- {
- new Rajh();
- new mobs_vents_solaires();
- new mobs_orbdusoleil();
- new mobs_flamesvent();
- new mobs_indicateur();
- new spell_BumpnDamage();
- new spell_Dotsoleil();
- }
Add Comment
Please, Sign In to add comment