void moveCloser(D3Object target) { if (target.DistanceFromPlayer > Range || D3Control.LOS(target)) D3Control.MoveTo(target, target.DistanceFromPlayer - 5); }
public static bool CastDHTargetSpell(string SpellName, D3Object target, out bool successful) { bool res = false; successful = false; if (CombatConfig.DHDefaultSettings.hasKRIDERSHOT && SpellName == "Elemental Arrow") return true; if (hasEnoughResource1ForSpell(SpellName)) { res = D3Control.NewCastTargetSpell(SpellName, target, out successful); } if (res) Thread.Sleep(CombatConfig.CombatSkillInterval); return res; }
public static bool CastCrusaderTargetSpell(string SpellName, D3Object target) { bool successfull = false; bool res = false; if (hasEnoughResourceForSpell(SpellName)) { return D3Control.NewCastTargetSpell(SpellName, target, out successfull); } if (res && successfull) Thread.Sleep(CombatConfig.CombatSkillInterval); return res && successfull; }
void handleStrafe() { CWSpellTimer checkBuffTimer = new CWSpellTimer(5 * 1000); CWSpellTimer castGeneratorTimer = new CWSpellTimer(CombatConfig.DHNatalyaWWSettings.HatredGeneratorTimer * 1000); if (D3Control.canCast("Strafe")) // { CWSpellTimer tempTimer2 = new CWSpellTimer(60 * 1000, false); var cancast = false; int retryTimes = 0; do { recast: bool RGBossFight = false; if (checkIgnoreandMaxTrial(ref LiveMobsAround)) break; if (!D3Control.IsInGame() || D3Control.Player.IsDead) { return; } if (D3Control.Player.HpPct < 45) D3Control.usePotion(); if (DoorCheckTimer.IsReady) { D3Control.openDoor(35); DoorCheckTimer.Reset(); } LiveMobsAround = D3Control.RetrieveAllObjects(maxScanRange, Descriptor.eActorType.Monster); // only live mobs will be returned. if (LiveMobsAround == null || LiveMobsAround.Count == 0) return; //float minDistance = float.MaxValue; bool closeEnemy = false; float minDistance = float.MaxValue; bool hasElite = false; for (int i = 0; i < LiveMobsAround.Count; i++)// (var mob in LiveMobsAround) { var mob = LiveMobsAround[i]; if (D3Control.ISRG((D3Unit)mob)) { RGBossFight = true; RGBoss = mob; } var distance = mob.DistanceFromPlayer; var los = D3Control.LOS(mob); if (minDistance > distance && !los) { minDistance = distance; if (distance <= 55) { closeEnemy = true; } } else if (distance >= 60) { // remove all the non-visible and far mobs LiveMobsAround.RemoveAt(i--); } if (!hasElite && ((D3Unit)mob).IsElite) hasElite = true; } if (!RGBossFight) RGBoss = null; if (!closeEnemy) // no more enemy nearby? return; //if (CombatConfig.SkillBuild == build.NatalyaWW && (CombatConfig.DHNatalyaWWSettings.RoVOnCD || CombatConfig.DHNatalyaWWSettings.natalyaRoVTimer.IsReady)) { // if (CombatConfig.DHNatalyaWWSettings.RoVInterval * 1000 != CombatConfig.DHNatalyaWWSettings.natalyaRoVTimer.Duration) // CombatConfig.DHNatalyaWWSettings.natalyaRoVTimer.ChangeDuration(CombatConfig.DHNatalyaWWSettings.RoVInterval * 1000); //if (D3Control.canCast("Rain of Vengeance")) // to test if the spell is enabled first then search the best location to cast it { var loc = Surroundings.FindMobBlock(ref LiveMobsAround, FindTypes.Max); if (CastDH1Spell("Rain of Vengeance", loc)) { ; } } } Vector3D strafeSpot = null; int lowLifeDistance = 5 * ((100 - D3Control.Player.HpPct) / 30); int eliteDistance = 0; if (hasElite) eliteDistance = 5; strafeSpot = WWCheckGlobeShrineLoc(); if (strafeSpot == null) { if (D3Control.isObjectValid(RGBoss)) strafeSpot = handleRGAOE(RGBoss.Location); //strafeSpot = selectWWLocation(55, ref LiveMobsAround, 15); } var mob1 = selectClosestMob(60, ref LiveMobsAround, 50); var hasFocusBuff = D3Control.HasBuff("Focus"); if (!hasFocusBuff) D3Control.output("No focus buff?"); if (CombatConfig.DHNatalyaWWSettings.CastHatredGenerator && (castGeneratorTimer.IsReady || !hasFocusBuff)) { handleHatredGeneratorSkills(mob1.Location); castGeneratorTimer.Reset(); } if (strafeSpot == null) { if (LiveMobsAround.Count > 1 && minDistance > CombatConfig.DHNatalyaWWSettings.FightDistance + lowLifeDistance + eliteDistance) { // too far from the enemies? if (mob1 != null) strafeSpot = mob1.Location; } else strafeSpot = newSelectStrafeLocation(55, ref LiveMobsAround, ref mob1, 40);// selectStrafeLocation(55, ref LiveMobsAround, 40); } if (D3Control.Player.HpPct <= 75) { if (CastDH2Spell("Shadow Power", D3Control.Player.Location)) { } else if (CastDH2Spell("Smoke Screen", D3Control.Player.Location)) { //return; } if (!D3Control.HasBuff("Shadow Power")) { if (CastDH2Spell("Shadow Power", D3Control.Player.Location)) { return; } } } if (strafeSpot != null) { if (CastDH1Spell("Strafe", strafeSpot)) { retryTimes = 0; D3Control.stopMoving(); //D3Control.output("Strafe Successful?"); //Thread.Sleep(50);// wait a bit? //if (checkBuffTimer.IsReady) { checkBuff(D3Control.Player); checkBuffTimer.Reset(); } //Thread.Sleep(100);// wait a bit? } else { if (retryTimes++ < 3 && D3Control.isSpellEnabled("Strafe")) { //LiveMobsAround = D3Control.RetrieveAllObjects(maxScanRange, Descriptor.eActorType.Monster); // only live mobs will be returned. //strafeSpot = selectStrafeLocation(55, ref LiveMobsAround, 40); goto recast; } D3Control.output("Strafe Failed?"); break; } } else { D3Control.output("No Strafe target?"); break; } cancast = D3Control.canCast("Strafe"); if (!cancast) { D3Control.output("Cannot Cast FStrafe"); } else { //Thread.Sleep(50); } } while (cancast && !tempTimer2.IsReady); } }
/// <summary> /// Cast a spell on the location timer information. Check that location has been casted a spell and the timer is not ready /// </summary> /// <param name="spellName"></param> /// <param name="mobTimers"></param> /// <param name="target"></param> /// <param name="timerValue"></param> /// <returns></returns> bool castDotSpellOnLocationTimerInfo(string spellName, ref List<D3Control.locTimer> locTimers, D3Object target, int timerValue, int range) { bool res = false; var location = target.Location; foreach (var info in locTimers) { // check the current target first. if (info.loc.GetDistanceTo(target.Location, true) < range) { // within the range of the location, dont do anything return false; } } if (CastWitchDoctorTargetSpell(spellName, target)) { // locTimers.Add(new D3Control.locTimer(location, timerValue));// reset the timer first, to cast the spell a head a little bit res = true; } else { } return res; }
bool castDotSpellOnTimerInfo(string spellName, List<D3Control.mobTimer> mobTimers, D3Object target, int timerValue) { bool res = false; bool inList = false; foreach (var info in mobTimers) { // check the current target first. if (info.obj == target) { // in the list, but timer is not ready if (info.timer.IsReady) { if (CastWitchDoctorTargetSpell(spellName, target)) { info.timer.Reset(); // reset the timer first, to cast the spell a head a little bit res = true; } } inList = true; break; } } if (!inList) { if (CastWitchDoctorTargetSpell(spellName, target)) { // mobTimers.Add(new D3Control.mobTimer(target, timerValue));// reset the timer first, to cast the spell a head a little bit res = true; } } return res; }
void handleHellTooth_WallOfDeathBuild() { CWSpellTimer checkBuffTimer = new CWSpellTimer(1 * 1000); CWSpellTimer checkAncientTimer = new CWSpellTimer(3 * 1000); CWSpellTimer overPowerTimer = new CWSpellTimer(4 * 1000); CWSpellTimer threateningShoutTimer = new CWSpellTimer(5 * 10000); //CWSpellTimer FGTimer = new CWSpellTimer(CombatConfig.BarbIKWWSettings.CastFuryGeneratorTimer * 1000); //if (D3Control.canCast("Whirlwind")) // { CWSpellTimer tempTimer2 = new CWSpellTimer(30 * 1000, false); var cancast = false; int retryTimes = 0; do { recast: try { if (!D3Control.IsInGame() || D3Control.Player.IsDead) { return; } if (D3Control.Player.HpPct < 45) D3Control.usePotion(); LiveMobsAround = D3Control.RetrieveAllObjects(maxScanRange, Descriptor.eActorType.Monster); // only live mobs will be returned. if (LiveMobsAround == null || LiveMobsAround.Count == 0) return; if (checkIgnoreandMaxTrial(ref LiveMobsAround)) break; int mobCountWithin18Yards = 0; foreach (var mob in LiveMobsAround) { if (mob.DistanceFromPlayer <= 18) mobCountWithin18Yards++; } if (DoorCheckTimer.IsReady) { D3Control.openDoor(35); DoorCheckTimer.Reset(); } //float minDistance = float.MaxValue; bool closeEnemy = false; float minDistance = float.MaxValue; bool hasElite = false; D3Object closestMob = null; bool RGBossFight = false; foreach (var mob in LiveMobsAround) { var distance = mob.DistanceFromPlayer; if (D3Control.ISRG((D3Unit)mob)) { RGBossFight = true; RGBoss = mob; } if (minDistance > distance) { minDistance = distance; closestMob = (D3Unit)mob; } if (!hasElite && ((D3Unit)mob).IsElite) hasElite = true; if (distance <= 55 && !D3Control.LOS(mob)) { closeEnemy = true; } } if (!RGBossFight) RGBoss = null; if (!closeEnemy) // no more enemy nearby? return; if (!D3Control.HasBuff("Focus") || primarySkillTimer.IsReady) { if (CastWitchDoctorTargetSpell("Corpse Spiders", closestMob)) { primarySkillTimer.Reset(); } } handleWallofDeathManaSpender(ref LiveMobsAround); handleWallofDeath(ref LiveMobsAround); Vector3D wwSpot = WWCheckGlobeShrineLoc(); //var t1 = D3Control.Player.Location; //var dist = wwSpot.GetDistanceTo(D3Control.Player.Location); if (wwSpot == null) { if (D3Control.Player.HpPct <= 80 && avoidAOETimer.IsReady && safeSpot != null) { D3Control.output("Try to avoid AOE"); wwSpot = safeSpot; avoidAOETimer.Reset(); } if (D3Control.isObjectValid(RGBoss)) wwSpot = handleRGAOE(RGBoss.Location); if (wwSpot == null) { wwSpot = SelectFightLocation(55, ref LiveMobsAround, ref closestMob, CombatConfig.WitchDoctorHellToothSettings.fightDistance, true);// selectStrafeLocation(55, ref LiveMobsAround, 40); } // wwSpot = selectWWLocation(55, ref LiveMobsAround, CombatConfig.BarbIKWWSettings.BossFightDistance); } var MaxMobBlock = Surroundings.FindMobBlock(ref LiveMobsAround, FindTypes.Max); if (MaxMobBlock == null) MaxMobBlock = closestMob.Location; if (D3Control.canCast("Piranhas")) { if (CastWitchDoctorSpell("Piranhas", MaxMobBlock)) { } } if (!D3Control.HasBuff("Focus") || primarySkillTimer.IsReady) { if (CastWitchDoctorTargetSpell("Corpse Spiders", closestMob)) { primarySkillTimer.Reset(); } } // cast it on CD if (mobCountWithin18Yards > 2) CastWitchDoctorSpell("Soul Harvest", D3Control.Player.Location); if (D3Control.Player.HpPct < CombatConfig.WitchDoctorHellToothSettings.spiritWalkHPPct && CastWitchDoctorSpell("Spirit Walk", D3Control.Player.Location)) { } if (wwSpot != null) { int retryPre = 0; tryPreiousSpot: var distance = wwSpot.GetDistanceTo(D3Control.Player.Location); D3Control.ClickMoveTo(wwSpot); Thread.Sleep(500); } else { D3Control.output("No move to location, move around a bit"); break; } } catch { } } while (!tempTimer2.IsReady); } }
public static Vector3D FindMobBlock(ref List<D3Object> liveMobs, FindTypes findType, out D3Object TargetMob) { Vector3D res = null; TargetMob = null; if (liveMobs != null && liveMobs.Count > 0) { initSurroundingBlocks(D3Control.Player.Location); foreach (var mob in liveMobs) { addMonsterLoc(mob.Location); } //var preTime = DateTime.Now; res = getDesiredTyeBlockCenter(findType); if (res != null) { foreach (var mob in liveMobs) { var mobLoc = mob.Location; if (D3Control.isObjectValid(mob) && mobLoc.GetDistanceTo(res, true) < 12) { res = mobLoc; TargetMob = mob; break; } } } //D3Control.output("time", string.Format("Time52 {0}", DateTime.Now.Subtract(preTime).TotalMilliseconds)); } return res; }
void handleCarnEvil() { CWSpellTimer checkBuffTimer = new CWSpellTimer(5 * 1000); CWSpellTimer castSpenderTimer = new CWSpellTimer(CombatConfig.WitchDoctorCarnEvilSettings.manaSpenderTimer * 1000); { CWSpellTimer tempTimer2 = new CWSpellTimer(60 * 1000, false); var cancast = false; int retryTimes = 0; do { recast: bool RGBossFight = false; if (checkIgnoreandMaxTrial(ref LiveMobsAround)) break; if (!D3Control.IsInGame() || D3Control.Player.IsDead) { return; } if (D3Control.Player.HpPct < 45) D3Control.usePotion(); checkBuff(D3Control.Player); if (DoorCheckTimer.IsReady) { D3Control.openDoor(35); DoorCheckTimer.Reset(); } LiveMobsAround = D3Control.RetrieveAllObjects(maxScanRange, Descriptor.eActorType.Monster); // only live mobs will be returned. if (LiveMobsAround == null || LiveMobsAround.Count == 0) return; //float minDistance = float.MaxValue; bool closeEnemy = false; float minDistance = float.MaxValue; bool hasElite = false; D3Object closeMob = null; for (int i = 0; i < LiveMobsAround.Count; i++)// (var mob in LiveMobsAround) { var mob = LiveMobsAround[i]; if (D3Control.ISRG((D3Unit)mob)) { RGBossFight = true; RGBoss = mob; } var distance = mob.DistanceFromPlayer; var los = D3Control.LOS(mob); if (minDistance > distance && !los) { minDistance = distance; if (distance <= 55) { closeEnemy = true; } closeMob = mob; } else if (distance >= 60) { // remove all the non-visible and far mobs LiveMobsAround.RemoveAt(i--); } if (!hasElite && ((D3Unit)mob).IsElite) hasElite = true; } if (!RGBossFight) RGBoss = null; if (!closeEnemy) // no more enemy nearby? return; Vector3D fightSpot = null; Vector3D spiritSpenderLoc2 = closeMob.Location; if (spiritSpenderLoc2.GetDistanceTo(D3Control.Player.Location) <= 18) { CastWitchDoctorSpell("Soul Harvest", D3Control.Player.Location); } if (RGBossFight) spiritSpenderLoc2 = RGBoss.Location; if (CastWitchDoctorSpell("Hex", closeMob.Location)) { } CastWitchDoctorSpell("Big Bad Voodoo", D3Control.Player.Location); //spiritSpenderLoc2 = D3Control.Player.Location; if (CastWitchDoctorSpell("Grasp of the Dead", spiritSpenderLoc2)) { //return; } if (castSpenderTimer.IsReady && handleSpenderSkills(spiritSpenderLoc2)) { castSpenderTimer.Reset(); } fightSpot = WWCheckGlobeShrineLoc(); if (fightSpot == null) { if (D3Control.isObjectValid(RGBoss)) fightSpot = handleRGAOE(RGBoss.Location); //strafeSpot = selectWWLocation(55, ref LiveMobsAround, 15); } //var mob1 = selectClosestMob(60, ref LiveMobsAround, 50); if (D3Control.Player.HpPct <= CombatConfig.WitchDoctorCarnEvilSettings.spiritWalkHPPct || D3Control.Player.isBeingCCed() || closeMob.DistanceFromPlayer < CombatConfig.WitchDoctorCarnEvilSettings.spiritWalkEnemyDistance) { if (CastWitchDoctorSpell("Spirit Walk", D3Control.Player.Location)) { } } if (fightSpot == null) { /*if (LiveMobsAround.Count > 1 && minDistance > CombatConfig.WitchDoctorCarnEvilSettings.fightDistance + lowLifeDistance + eliteDistance) { // too far from the enemies? if (mob1 != null) strafeSpot = mob1.Location; } else/**/ fightSpot = SelectFightLocation(55, ref LiveMobsAround, ref closeMob, CombatConfig.WitchDoctorCarnEvilSettings.fightDistance, false);// selectStrafeLocation(55, ref LiveMobsAround, 40); } if (fightSpot != null && fightSpot.GetDistanceTo(D3Control.Player.Location) > 5) // strafeSpot != null) { D3Control.output("Move to a better place."); D3Control.ClickMoveToWait(fightSpot); } else { D3Control.stopMoving(); D3Control.output("No need to move?"); } //CastWitchDoctorDirectionSpell("Poison Dart", closeMob.Location); CastWitchDoctorTargetSpell("Poison Dart", closeMob); } while (!tempTimer2.IsReady); } }
public static bool CastMonkTargetSpell(string SpellName, D3Object target) { bool res = false; if (hasEnoughResourceForSpell(SpellName)) { bool successfull = false; res = D3Control.NewCastTargetSpell(SpellName, target, out successfull); if (res && successfull) { //D3Control.output(SpellName); //Thread.Sleep(CombatConfig.CombatSkillInterval); } } return res; }
public static bool CastWizardTargetSpell(string SpellName, D3Object target) { bool res = false; bool canCast = false; SpellName = getRealArchonSpellName(SpellName, out canCast); if (!canCast) return false; bool successfull = false; if (hasEnoughResourceForSpell(SpellName)) { res = D3Control.NewCastTargetSpell(SpellName, target, out successfull); } if (res && successfull) Thread.Sleep(spellCastInterval); return res && successfull; }
// the always teleport build void handleTalRashaAetherWalker() { CWSpellTimer checkBuffTimer = new CWSpellTimer(5 * 1000); CWSpellTimer teleportTimer = new CWSpellTimer(3 * 1000); CWSpellTimer blizzTimer = new CWSpellTimer(7000); // 5.5 secs to make sure you get the tr6 buffer CWSpellTimer hydraTimer = new CWSpellTimer(7000); CWSpellTimer hydraHardTimer = new CWSpellTimer(2500); // wait at least this time to test again hydra # CWSpellTimer bossFightMoveTimer = new CWSpellTimer(3000); Vector3D lastBlizzLoc = null; Vector3D bossFightSpot = null; CWSpellTimer ConventionPrepareTimer = new CWSpellTimer(2 * 1000); CWSpellTimer TaegukTimer = new CWSpellTimer(2500); bool enteredPrepareState = false; // if (D3Control.canCast("Strafe")) // { CWSpellTimer tempTimer2 = new CWSpellTimer(120 * 1000, false); int retryTimes = 0; do { recast: bool RGBossFight = false; DateTime startTime = DateTime.Now; if (checkIgnoreandMaxTrial(ref LiveMobsAround)) break; if (!D3Control.IsInGame() || D3Control.Player.IsDead) { return; } if (D3Control.Player.HpPct < 45) D3Control.usePotion(); if (DoorCheckTimer.IsReady) { D3Control.openDoor(35); DoorCheckTimer.Reset(); } D3Control.CoEType CoEBuffType = D3Control.GetCoEBuffType(); if (CoEBuffType == D3Control.CoEType.Cold) { if (!enteredPrepareState) { ConventionPrepareTimer.Reset(); } if (ConventionPrepareTimer.IsReady) { // once this is ready, enter the bombing state enteredPrepareState = true; } } else { enteredPrepareState = false; } LiveMobsAround = D3Control.RetrieveAllObjects(maxScanRange, Descriptor.eActorType.Monster); // only live mobs will be returned. if (LiveMobsAround == null || LiveMobsAround.Count == 0) return; checkBuff(D3Control.Player); //float minDistance = float.MaxValue; bool closeEnemy = false; float minDistance = float.MaxValue; bool hasElite = false; foreach (var mob in LiveMobsAround) { if (D3Control.ISRG((D3Unit)mob)) { RGBossFight = true; RGBoss = mob; } var distance = mob.DistanceFromPlayer; if (minDistance > distance) minDistance = distance; if (!hasElite && ((D3Unit)mob).IsElite) hasElite = true; if (distance <= 55 && !D3Control.LOS(mob)) { closeEnemy = true; } } if (!RGBossFight) RGBoss = null; if (!closeEnemy && !RGBossFight) // no more enemy nearby? return; var playerHP = D3Control.Player.HpPct; bossFightSpot = null; var coeState = D3Control.GetCoEBuffType(); bool canCastTeleport = D3Control.canCast("Teleport"); if (RGBossFight && D3Control.canCast("Teleport")) { // if boss fight && move timer is ready or teleport is ready, MOVE var bossLoc = RGBoss.Location; if (enteredPrepareState || coeState == D3Control.CoEType.Fire) { handleAetherWalkerBossFight(bossLoc); } else { D3Control.output("Boss fight, no nuke time now, trying to get a safe spot"); bool hasGoodSpot = false; for (int i = 1; i < 12; i++) { if (!canCastTeleport && (i > 3 || i < 10)) continue; bossFightSpot = D3Control.getStartSideSpot(bossLoc, D3Control.Player.Location, i * 30, 50); if (!D3Control.LOS(bossFightSpot)) { hasGoodSpot = true; break; } } if (!hasGoodSpot) { D3Control.output("Cannot find a good spot?"); bossFightSpot = D3Control.getStartSideSpot(bossLoc, D3Control.Player.Location, 0, 35); } if (bossFightSpot != null) { if (TaegukTimer.IsReady || D3Control.Player.HpPct < 50 || bossFightSpot.GetDistanceTo(D3Control.Player.Location) < 30) { CastWizardSpell("Teleport", bossFightSpot); Thread.Sleep(600); TaegukTimer.Reset(); } else //if (CastWizardSpell("Teleport", bossFightSpot)) { D3Control.ClickMoveToWait(bossFightSpot); } } } } // no a boss fight //if (D3Control.canCast("Teleport")) { Vector3D teleportSpot = null; Vector3D meteorSpot = null; teleportSpot = CheckGlobeShrineLoc(); if (teleportSpot == null) { if (D3Control.isObjectValid(RGBoss)) teleportSpot = handleRGAOE(RGBoss.Location); //strafeSpot = selectWWLocation(55, ref LiveMobsAround, 15); } meteorSpot= Surroundings.FindMobBlock(ref LiveMobsAround, FindTypes.Max); if (teleportSpot == null )//&& (teleportTimer.IsReady || playerHP <= 60)) { // no need to get health globe or the shadow power if (playerHP <= 40)//&& LiveMobsAround.Count == 1) { // hp too low or RG fight, find a safe place? teleportSpot = Surroundings.FindMobBlock(ref LiveMobsAround, FindTypes.Min); } else { teleportSpot = meteorSpot; } if (teleportSpot == null) { teleportSpot = D3Control.Player.Location; } } if (teleportSpot != null) { if (enteredPrepareState || D3Control.GetCoEBuffType() == D3Control.CoEType.Fire) { handleAetherWalkerTrashFight(teleportSpot, meteorSpot); } else { if (teleportSpot != null) { if (CastWizardSpell("Teleport", teleportSpot)) { teleportTimer.Reset(); Thread.Sleep(150); } } } } //D3Control.output(string.Format("Loop time {0}", DateTime.Now.Subtract(startTime).TotalMilliseconds)); }/**/ } while (!tempTimer2.IsReady); } } bool isFirstKillTarget(D3Unit mob) { bool res = false; res = D3Control.TargetManager.FirstKillTargetIDs.Contains(mob.ID); return res; } bool IsMobTS(D3Object mob) { bool res = false; res = D3Control.IsMobTS(mob); return res; } void KeepTaeguk() { } void moverun(Vector3D location) { if (moveBackTimer.IsReady) { moveBackTimer.Reset(); float distance = D3Control.Player.DistanceTo(location); D3Control.ClickMoveTo(location); try { Thread.Sleep((int)(distance * 1000 / D3Control.Player.speed)); } catch { } } } bool try2AvoidAOE() { if (D3Control.AOETimer * 1000 != moveBackTimer.Duration) moveBackTimer.ChangeDuration(D3Control.AOETimer * 1000); if (safeSpot != null && moveBackTimer.IsReady) { var tempSpot = safeSpot; safeSpot = null; D3Control.output("AOE detected, try to avoid those."); DateTime start = DateTime.Now; moverun(tempSpot); // D3Control.output(string.Format("{0}", DateTime.Now.Subtract(start).TotalMilliseconds)); D3Control.output("Done"); return true; } return false; } #endregion Methods #region Nested Types class TalRashaHandler { #region Methods /*void HandleSignatureSpell() { bool noCloseEnemy = false; if (D3Control.canCast("Electrocute")) { var retryElectrocuteTime = 0; Vector3D ElectroLoc = null; retryElectrocute: D3Control.output(string.Format("Electrocute {0}", retryElectrocuteTime)); if ((ElectrocuteRune)D3Control.GetSpellRuneIndex("Electrocute") == ElectrocuteRune.ArcLightning) { // a location spell var mobDistance = closestMob.DistanceFromPlayer; var closestMobv1 = closestMob.Location; if (true)//mobDistance <= 15) { ElectroLoc = closestMobv1; //CastWizardSpell("Electrocute", closestMobv1); } else { ElectroLoc = D3Control.getMySideSpot(closestMobv1, 0, 12); noCloseEnemy = true; //CastWizardSpell("Electrocute", ElectroLoc); } if (ElectroLoc == null) ElectroLoc = D3Control.Player.Location; } else { ElectroLoc = closestMob.Location; } if (!CastWizardSpell("Electrocute", ElectroLoc)) { Thread.Sleep(300); if (retryElectrocuteTime++ < 3) { goto retryElectrocute; } } if (noCloseEnemy) D3Control.MoveTo(closestMob.Location, 12); } }/**/ void handleBlizz() { } #endregion Methods }
void handleTalRasha() { CWSpellTimer checkBuffTimer = new CWSpellTimer(5 * 1000); CWSpellTimer teleportTimer = new CWSpellTimer(3 * 1000); CWSpellTimer blizzTimer = new CWSpellTimer(7000); // 5.5 secs to make sure you get the tr6 buffer CWSpellTimer hydraTimer = new CWSpellTimer(7000); CWSpellTimer hydraHardTimer = new CWSpellTimer(2500); // wait at least this time to test again hydra # CWSpellTimer bossFightMoveTimer = new CWSpellTimer(2000); Vector3D lastBlizzLoc = null; Vector3D bossFightSpot = null; CWSpellTimer ConventionPrepareTimer = new CWSpellTimer(2 * 1000); CWSpellTimer TaegukTimer = new CWSpellTimer(3 * 1000); // if (D3Control.canCast("Strafe")) // { CWSpellTimer tempTimer2 = new CWSpellTimer(120 * 1000, false); int retryTimes = 0; do { recast: bool RGBossFight = false; // DateTime startTime = DateTime.Now; if (checkIgnoreandMaxTrial(ref LiveMobsAround)) break; if (!D3Control.IsInGame() || D3Control.Player.IsDead) { return; } if (D3Control.Player.HpPct < 45) D3Control.usePotion(); if (DoorCheckTimer.IsReady) { D3Control.openDoor(35); DoorCheckTimer.Reset(); } LiveMobsAround = D3Control.RetrieveAllObjects(maxScanRange, Descriptor.eActorType.Monster); // only live mobs will be returned. if (LiveMobsAround == null || LiveMobsAround.Count == 0) return; checkBuff(D3Control.Player); //float minDistance = float.MaxValue; bool closeEnemy = false; float minDistance = float.MaxValue; bool hasElite = false; foreach (var mob in LiveMobsAround) { if (D3Control.ISRG((D3Unit)mob)) { RGBossFight = true; RGBoss = mob; } var distance = mob.DistanceFromPlayer; if (minDistance > distance) minDistance = distance; if (!hasElite && ((D3Unit)mob).IsElite) hasElite = true; if (distance <= 55 && !D3Control.LOS(mob)) { closeEnemy = true; } } if (!RGBossFight) RGBoss = null; if (!closeEnemy) // no more enemy nearby? return; var playerHP = D3Control.Player.HpPct; bossFightSpot = null; bool canCastTeleport = D3Control.canCast("Teleport"); if (RGBossFight && (bossFightMoveTimer.IsReady || D3Control.canCast("Teleport"))) { // if boss fight && move timer is ready or teleport is ready, MOVE var bossLoc = RGBoss.Location; //D3Control.output("Boss fight, trying to get a side spot"); bool hasGoodSpot = false; for (int i = 1; i < 12; i++) { if (!canCastTeleport && (i > 3 || i < 10)) continue; bossFightSpot = D3Control.getStartSideSpot(bossLoc, D3Control.Player.Location, i * 30, 40); if (!D3Control.LOS(bossFightSpot)) { hasGoodSpot = true; break; } } if (!hasGoodSpot) bossFightSpot = D3Control.getStartSideSpot(bossLoc, D3Control.Player.Location, 0, 30); //tel } if (D3Control.canCast("Teleport")) { Vector3D teleportSpot = null; teleportSpot = CheckGlobeShrineLoc(); if (teleportSpot == null) { if (D3Control.isObjectValid(RGBoss)) teleportSpot = handleRGAOE(RGBoss.Location); //strafeSpot = selectWWLocation(55, ref LiveMobsAround, 15); if (teleportSpot == null) teleportSpot = bossFightSpot; } if (teleportSpot == null && (teleportTimer.IsReady || playerHP <= 60)) { // no need to get health globe or the shadow power if (playerHP <= 40)//&& LiveMobsAround.Count == 1) { // hp too low or RG fight, find a safe place? teleportSpot = Surroundings.FindMobBlock(ref LiveMobsAround, FindTypes.Min); } else if (RGBossFight) { teleportSpot = bossFightSpot; } else //if (playerHP <= 60) { // low on life, try to teleport to a mob far away //teleportSpot = selectTeleportLocation(55, ref LiveMobsAround, 40);// Surroundings.FindMobBlock(ref LiveMobsAround, FindTypes.Min); var teleportToMob = selectFarestMob(55, ref LiveMobsAround, 40);// Surroundings.FindMobBlock(ref LiveMobsAround, FindTypes.Min); if (teleportToMob != null) teleportSpot = teleportToMob.Location; } if (teleportSpot == null) { teleportSpot = D3Control.Player.Location; } /*else { // hpPct ok, try to find a block with densest mobs teleportSpot = Surroundings.FindMobBlock(ref LiveMobsAround, FindTypes.Max); bool goodSpot = false; if (teleportSpot != null && teleportSpot.GetDistanceTo(D3Control.Player.Location) > 12) { // the target spot is good to go goodSpot = true; } if (!goodSpot) { var teleportToMob = selectFarestMob(55, ref LiveMobsAround, 40);// Surroundings.FindMobBlock(ref LiveMobsAround, FindTypes.Min); if (teleportToMob != null) teleportSpot = teleportToMob.Location; } }/**/ } if (teleportSpot != null) { if (CastWizardSpell("Teleport", teleportSpot)) { teleportTimer.Reset(); Thread.Sleep(150); } } } if (/*!blizzTimer.IsReady &&*/ hydraTimer.IsReady && (hydraTimer.IsReady || CombatConfig.WizardTalRashaSettings.HydraCount > D3.D3Control.getWizHydraNumber(50))) { // make sure blizz is casted first, cuz it consumes more arcane power int hydraRetryTime = 0; retryCastHydra: Vector3D hydraLoc = null; if (RGBossFight) { /*if (LiveMobsAround.Count == 1) { if (RGBoss.DistanceFromPlayer < 40) hydraLoc = D3Control.Player.Location; else hydraLoc = RGBoss.Location; } else/**/ hydraLoc = RGBoss.Location; } else { hydraLoc = D3Control.Player.Location; } var FlashesOfInsightBuffCount = D3Control.BuffStackCount("Tal Rasha's Elements"); if (CastWizardSpell("Hydra", hydraLoc)) { hydraTimer.Reset(); D3Control.output("Hydra successful?"); Thread.Sleep(150); } else { // some how the cast spell successful or not does not work sometimes here. no idea, need more testing Thread.Sleep(200); if (FlashesOfInsightBuffCount < D3Control.BuffStackCount("Tal Rasha's Elements")) { // successfull hydraHardTimer.Reset(); D3Control.output("Hydra successful?"); } else D3Control.output("Hydra failed?"); /* if (hydraRetryTime++ < 3) { Thread.Sleep(150); goto retryCastHydra; }/**/ } hydraHardTimer.Reset(); } var closestMob = selectClosestMob(50, ref LiveMobsAround, 45);// if (blizzTimer.IsReady || D3Control.Player.ArcanePower > 50) { // to cast blizz int retryBlizzTime = 0; retryCastBlizz: var nearMobsCount = GetNearByEnemy(ref LiveMobsAround, 12); Vector3D tempBlizzLoc = null; if (nearMobsCount != null && nearMobsCount.Count > 0) { // some mobs around, cast it right around the player tempBlizzLoc = D3Control.Player.Location; // D3Control.output("Cast blizz at the player location"); } else { tempBlizzLoc = Surroundings.FindMobBlock(ref LiveMobsAround, FindTypes.Max); // D3Control.output("Cast blizz at the densest mob location"); } if (tempBlizzLoc == null) { if (closestMob != null) { // D3Control.output("Cast blizz at the closest mob"); tempBlizzLoc = closestMob.Location; } } if (tempBlizzLoc == null) tempBlizzLoc = D3Control.Player.Location; if (tempBlizzLoc != null) { lastBlizzLoc = tempBlizzLoc; if (!CastWizardSpell("Blizzard", tempBlizzLoc)) { if (retryTimes++ < 3) { Thread.Sleep(150); goto retryCastBlizz; } } else { blizzTimer.Reset(); Thread.Sleep(150); } } } if (RGBossFight && bossFightMoveTimer.IsReady && bossFightSpot != null) { D3Control.ClickMoveToWait(bossFightSpot); } bool noCloseEnemy = false; //for (int i = 0; i < 3; i++) { if (D3Control.canCast("Electrocute")) { var retryElectrocuteTime = 0; Vector3D ElectroLoc = null; retryElectrocute: //D3Control.output(string.Format("Electrocute {0}", retryElectrocuteTime)); if ((ElectrocuteRune)D3Control.GetSpellRuneIndex("Electrocute") == ElectrocuteRune.ArcLightning) { // a location spell var mobDistance = closestMob.DistanceFromPlayer; var closestMobv1 = closestMob.Location; if (!RGBossFight || mobDistance < 15)//mobDistance <= 15) { ElectroLoc = closestMobv1; //CastWizardSpell("Electrocute", closestMobv1); } else { ElectroLoc = D3Control.Player.Location; /* ElectroLoc = D3Control.getMySideSpot(closestMobv1, 0, 12); noCloseEnemy = true; /**/ //CastWizardSpell("Electrocute", ElectroLoc); }/**/ if (ElectroLoc == null) ElectroLoc = D3Control.Player.Location; } else { ElectroLoc = closestMob.Location; } if (!CastWizardSpell("Electrocute", ElectroLoc)) { /*Thread.Sleep(500); if (retryElectrocuteTime++ < 3) { goto retryElectrocute; }/**/ } else { Thread.Sleep(150); } if (noCloseEnemy) D3Control.MoveTo(closestMob.Location, 12); } } } while (!tempTimer2.IsReady); } }