Fixed Vardison's Infinite Minion Summoning

This commit is contained in:
Robert Fritzen 2015-07-21 15:06:46 -05:00
parent 9add24b42e
commit 3d2152c5bb

View file

@ -503,11 +503,11 @@ function ShadowOrb::onDestroyed(%this, %obj, %prevState) {
if (%obj.isRemoved) { if (%obj.isRemoved) {
return; return;
} }
if(isObject($TWM2::VardisonManager.OrbSFX)) {
$TWM2::VardisonManager.OrbSFX.schedule(500, "delete");
}
%obj.isRemoved = true; %obj.isRemoved = true;
Parent::onDestroyed(%this, %obj, %prevState); Parent::onDestroyed(%this, %obj, %prevState);
if(isObject(%orb.sfx)) {
%obj.sfx.schedule(500, "delete");
}
%obj.schedule(500, "delete"); %obj.schedule(500, "delete");
$TWM2::VardisonManager.orbDestroyed(); $TWM2::VardisonManager.orbDestroyed();
} }
@ -725,17 +725,19 @@ function VardisonThink(%Boss) {
//If we're not ready to dish out an attack, let's check what else we need to do... //If we're not ready to dish out an attack, let's check what else we need to do...
// Are we low on minions? // Are we low on minions?
if($TWM2::VardisonManager.minionCount < $TWM2::Vardison1_MaxMinions[%dLevel]) { if($TWM2::VardisonManager.minionCount < $TWM2::Vardison1_MaxMinions[%dLevel]) {
if(%Boss.canSummonMinions) {
//How many players am I up against? //How many players am I up against?
%pCount = $HostGamePlayerCount; %pCount = $HostGamePlayerCount;
//How low is my health? //How low is my health?
%percentage = mCeil((mFloor(%boss.getDamageLeft()*100) / mFloor(%boss.getMaxDamage()*100)) * 100); %percentage = mCeil((mFloor(%boss.getDamageLeft()*100) / mFloor(%boss.getMaxDamage()*100)) * 100);
%BackwardsHP = 100 - %percentage; %BackwardsHP = 100 - %percentage;
%chance = %BackwardsHP * %pCount * (%Boss.canSummonMinions ? 1 : 0); %chance = %BackwardsHP * %pCount;
//Using our test factor, determine if I need minions. //Using our test factor, determine if I need minions.
if(%chance <= getRandom(1, 100)) { if(%chance <= getRandom(1, 100)) {
%needMinions = true; %needMinions = true;
} }
} }
}
//Do I need to be moving towards the enemy? //Do I need to be moving towards the enemy?
%needMove = true; //Phase 1 is always doing this... %needMove = true; //Phase 1 is always doing this...
} }
@ -759,17 +761,19 @@ function VardisonThink(%Boss) {
//If we're not ready to dish out an attack, let's check what else we need to do... //If we're not ready to dish out an attack, let's check what else we need to do...
// Are we low on minions? // Are we low on minions?
if($TWM2::VardisonManager.minionCount < $TWM2::Vardison2_MaxMinions[%dLevel]) { if($TWM2::VardisonManager.minionCount < $TWM2::Vardison2_MaxMinions[%dLevel]) {
if(%Boss.canSummonMinions) {
//How many players am I up against? //How many players am I up against?
%pCount = $HostGamePlayerCount; %pCount = $HostGamePlayerCount;
//How low is my health? //How low is my health?
%percentage = mCeil((mFloor(%boss.getDamageLeft()*100) / mFloor(%boss.getMaxDamage()*100)) * 100); %percentage = mCeil((mFloor(%boss.getDamageLeft()*100) / mFloor(%boss.getMaxDamage()*100)) * 100);
%BackwardsHP = 100 - %percentage; %BackwardsHP = 100 - %percentage;
%chance = %BackwardsHP * %pCount * (%Boss.canSummonMinions ? 1 : 0); %chance = %BackwardsHP * %pCount;
//Using our test factor, determine if I need minions. //Using our test factor, determine if I need minions.
if(%chance <= getRandom(1, 100)) { if(%chance <= getRandom(1, 100)) {
%needMinions = true; %needMinions = true;
} }
} }
}
//Phase 2 is stationary unless you're on Hard or WTF mode //Phase 2 is stationary unless you're on Hard or WTF mode
if(%dLevel >= 3) { if(%dLevel >= 3) {
%needMove = true; %needMove = true;
@ -800,18 +804,20 @@ function VardisonThink(%Boss) {
else { else {
//If we're not ready to dish out an attack, let's check what else we need to do... //If we're not ready to dish out an attack, let's check what else we need to do...
// Are we low on minions? // Are we low on minions?
if($TWM2::VardisonManager.minionCount < $TWM2::Vardison3_MaxMinions[%dLevel]) { if($TWM2::VardisonManager.minionCount < $TWM2::Vardison3_MaxMinions[%dLevel] && %boss.canSummonMinions) {
if(%Boss.canSummonMinions) {
//How many players am I up against? //How many players am I up against?
%pCount = $HostGamePlayerCount; %pCount = $HostGamePlayerCount;
//How low is my health? //How low is my health?
%percentage = mCeil((mFloor(%boss.getDamageLeft()*100) / mFloor(%boss.getMaxDamage()*100)) * 100); %percentage = mCeil((mFloor(%boss.getDamageLeft()*100) / mFloor(%boss.getMaxDamage()*100)) * 100);
%BackwardsHP = 100 - %percentage; %BackwardsHP = 100 - %percentage;
%chance = %BackwardsHP * %pCount * (%Boss.canSummonMinions ? 1 : 0); %chance = %BackwardsHP * %pCount;
//Using our test factor, determine if I need minions. //Using our test factor, determine if I need minions.
if(%chance <= getRandom(1, 100)) { if(%chance <= getRandom(1, 100)) {
%needMinions = true; %needMinions = true;
} }
} }
}
//Do I need to be moving towards the enemy? //Do I need to be moving towards the enemy?
%needMove = true; //Phase 3 is always doing this... %needMove = true; //Phase 3 is always doing this...
} }
@ -980,6 +986,7 @@ function VardisonSummonOrb(%Boss) {
} }
function VardisonSummonMinions(%Boss) { function VardisonSummonMinions(%Boss) {
if(%Boss.canSummonMinions) {
%currentCount = $TWM2::VardisonManager.minionCount; %currentCount = $TWM2::VardisonManager.minionCount;
%dLevel = $TWM2::VardisonDifficulty; %dLevel = $TWM2::VardisonDifficulty;
%max = 0; %max = 0;
@ -991,14 +998,16 @@ function VardisonSummonMinions(%Boss) {
case 3: case 3:
%max = $TWM2::Vardison3_MaxMinions[%dLevel]; %max = $TWM2::Vardison3_MaxMinions[%dLevel];
} }
%factor = %dLevel / 4;
%Low = 1; %Low = 1;
%High = %max - %currentCount; %High = mCeil((%max - %currentCount) * %factor);
for(%i = 0; %i < getRandom(%Low, %High); %i++) { for(%i = 0; %i < getRandom(%Low, %High); %i++) {
VardisonDoMinionSummon(%Boss); VardisonDoMinionSummon(%Boss);
} }
%Boss.canSummonMinions = false; %Boss.canSummonMinions = false;
$TWM2::VardisonManager.schedule($TWM2::Vardison_MinionCooldown[%dLevel] * 1000, cooldownOff, %Boss, "minions"); $TWM2::VardisonManager.schedule($TWM2::Vardison_MinionCooldown[%dLevel] * 1000, cooldownOff, %Boss, "minions");
} }
}
function VardisonDoMinionSummon(%Boss) { function VardisonDoMinionSummon(%Boss) {
%posSpawn = vectorAdd(%Boss.getPosition(), getRandomposition(50, 1)); %posSpawn = vectorAdd(%Boss.getPosition(), getRandomposition(50, 1));
@ -1642,12 +1651,12 @@ function VardisonManager::summonOrb(%this, %boss) {
setTargetName(%orb.target, addtaggedstring("\c7Shadow Rift")); setTargetName(%orb.target, addtaggedstring("\c7Shadow Rift"));
//SFX //SFX
%orb.sfx = new ParticleEmissionDummy(){ $TWM2::VardisonManager.OrbSFX = new ParticleEmissionDummy(){
position = %orb.getPosition(); position = %orb.getPosition();
dataBlock = "defaultEmissionDummy"; dataBlock = "defaultEmissionDummy";
emitter = "ShadowOrbEmitter"; emitter = "ShadowOrbEmitter";
}; };
MissionCleanup.add(%orb.sfx); MissionCleanup.add($TWM2::VardisonManager.OrbSFX);
// //
%this.orbKillSched = %this.schedule($TWM2::Vardison_OrbKillTime, orbKill, %boss, %orb); %this.orbKillSched = %this.schedule($TWM2::Vardison_OrbKillTime, orbKill, %boss, %orb);
} }
@ -1657,10 +1666,11 @@ function VardisonManager::orbKill(%this, %boss, %orb) {
%cl = ClientGroup.getObject(%i); %cl = ClientGroup.getObject(%i);
if(isObject(%cl.player) && %cl.player.getState() !$= "dead") { if(isObject(%cl.player) && %cl.player.getState() !$= "dead") {
//Bye Bye :) //Bye Bye :)
%cl.player.rapierShield = false;
%cl.player.setInvincible(false); %cl.player.setInvincible(false);
%cl.player.damage(%boss, %cl.player.getPosition(), 10000, $DamageType::ShadowOrb); %cl.player.damage(%boss, %cl.player.getPosition(), 10000, $DamageType::ShadowOrb);
%cl.player.blowup(); %cl.player.blowup();
MessageAll('msgDeath', "\c2"@%cl.player.namebase@" has been annihilated by the Shadow Rift."); MessageAll('msgDeath', "\c2"@%cl.namebase@" has been annihilated by the Shadow Rift.");
//If Vardison Restores HP from rift kills, do that now :P //If Vardison Restores HP from rift kills, do that now :P
if($TWM2::Vardison_OrbRegenHP[$TWM2::VardisonDifficulty]) { if($TWM2::Vardison_OrbRegenHP[$TWM2::VardisonDifficulty]) {
%boss.setDamageLevel(%boss.getDamageLevel() - 0.35); %boss.setDamageLevel(%boss.getDamageLevel() - 0.35);
@ -1674,8 +1684,8 @@ function VardisonManager::orbKill(%this, %boss, %orb) {
}; };
%wipeEmit.schedule(500, "delete"); %wipeEmit.schedule(500, "delete");
//Delete the orb & it's effects //Delete the orb & it's effects
if(isObject(%orb.sfx)) { if(isObject($TWM2::VardisonManager.OrbSFX)) {
%obj.sfx.schedule(500, "delete"); $TWM2::VardisonManager.OrbSFX.schedule(500, "delete");
} }
%orb.schedule(500, "delete"); %orb.schedule(500, "delete");
if(isObject(%this.orbFire)) { if(isObject(%this.orbFire)) {