public static async Task <bool> LeaveFinishedRift() { var turnInStep = RiftHelper.RiftQuest?.Step == RiftQuest.RiftStep.NotStarted && RiftHelper.RiftQuest?.State == QuestState.InProgress; if (turnInStep) { if (Targetting.RoutineWantsToLoot()) { return(true); } if (Player.IsInRift || Player.IsIsInGreaterRift) { Log.Info("Going to town, rift is finished"); await CommonCoroutines.UseTownPortal(); return(true); } if (Player.IsInTown && AutoFollow.CurrentLeader != null && !AutoFollow.CurrentLeader.IsInTown) { Log.Info("Waiting for leader to return to town"); await Coroutine.Sleep(1000); return(true); } } return(false); }
// Update is called once per frame void Update() { Targetting tg = (Targetting)player.GetComponent("Targetting"); if (tg.selectedTarget != null) { target = tg.selectedTarget; } if (tg.selectedTarget == null) { target = null; } if (target != null) { myCamera.rotation = Quaternion.Slerp(myCamera.rotation, Quaternion.LookRotation(target.position - myCamera.position), rotationSpeed * Time.deltaTime); player.rotation = Quaternion.Slerp(player.rotation, Quaternion.LookRotation(target.position - player.position), rotationSpeed * Time.deltaTime); } // restricting players rotation to the Y axis Vector3 eulerAngles = player.rotation.eulerAngles; eulerAngles = new Vector3(0, eulerAngles.y, 0); player.rotation = Quaternion.Euler(eulerAngles); }
private static void Loading_OnLoadingComplete(EventArgs args) { try { if (Rengar.Hero != Champion.Rengar) { return; } Game.OnUpdate += Game_OnUpdate; LaneClear.Initialize(); JungleClear.Initialize(); Menu.Init(); Misc.Init(); Targetting.Initialize(); Orbwalker.OnPostAttack += Orbwalker_OnPostAttack; Orbwalker.OnPreAttack += Orbwalker_OnPreAttack; Obj_AI_Base.OnProcessSpellCast += Obj_AI_Base_OnProcessSpellCast; Dash.OnDash += Combo.Dash_OnDash; Drawing.OnDraw += Drawing_OnDraw; Chat.Print("RengarPro Revamped | Loaded !", Color.Blue); Chat.Print("RengarPro Revamped | Coded by Rexy", Color.BlueViolet); Chat.Print("RengarPro Revamped | Say Hello To New Renglet", Color.Crimson); } catch (Exception e) { Console.WriteLine(e); } }
public void SpawnDebris() { bool done = false; int attempts = 0; while (!done && attempts < 50) { debris = DebrisInfo.instance.DebrisList[Random.Range(0, DebrisLevel)]; Vector2 position = FirstSpawner.transform.position; position.x -= FirstSpawner.size.x / 2; position.y -= FirstSpawner.size.y / 2; position.x += Mathf.RoundToInt(Random.Range(0, FirstSpawner.size.x - 1)) + .5f; position.y += Mathf.RoundToInt(Random.Range(0, FirstSpawner.size.y - 1)) + .5f; Vector2 offset = debris.GetComponent <BoxCollider2D>().offset; Vector2 size = debris.GetComponent <BoxCollider2D>().size; size.x -= .5f; size.y -= .5f; if (!Physics2D.BoxCast(position + offset, size, 0, Vector2.zero, .1f, obsticleMask)) { if (Random.Range(1, 11) == 10) { Instantiate(coin, position, Quaternion.identity, null); return; } else { GameObject target = Instantiate(targetting, position + offset, Quaternion.identity, null); Targetting tg = target.GetComponent <Targetting>(); tg.Debris = debris; size.x += .5f; size.y += .5f; tg.transform.localScale = size; } done = true; } // Vector2 position = FirstSpawner.transform.position; // position.x -= FirstSpawner.size.x / 2; // position.y -= FirstSpawner.size.y / 2; // position.x += Mathf.RoundToInt( Random.Range(0, FirstSpawner.size.x-1))+.5f; // position.y += Mathf.RoundToInt(Random.Range(0, FirstSpawner.size.y-1))+.5f; // if (!Physics2D.BoxCast(position, new Vector2(.5f ,.5f), 0, Vector2.zero, .1f, obsticleMask )) // { // done = true; // if(Random.Range(1,11) == 10) // { // Instantiate(coin, position, Quaternion.identity, null); // } // else // Instantiate(debris, position, Quaternion.identity, null); // //Debug.Log(position); // currSpawnTime = Random.Range(MinSpawnTime, MaxSpawnTime); // } attempts++; } }
private void Awake() { if (instance != null) { Debug.Log("Too many Targetting scripts!"); return; } instance = this; }
public override void PlayCard(bool playedByAI) { base.PlayCard(playedByAI); if (!playedByAI) { Targetting targetting = Targetting.instance; targetting.SelectObjectAoE(0); targetting.currentCondition = Targetting.TargetCondition.isFriendlyCity; EmergencyShieldAction emergencyShieldAction = new EmergencyShieldAction(); emergencyShieldAction.actionName = "Emergency Shield"; emergencyShieldAction.actionType = 1; emergencyShieldAction.effectedCity = null; emergencyShieldAction.shieldStrength = shieldsRestored; ResolutionPhase rP = ResolutionPhase.instance; rP.storedDefenceAction = emergencyShieldAction; } }
/// <summary> /// Move to another bot /// </summary> /// <param name="player">a player to move to</param> /// <param name="range">the closeness required</param> public static async Task <bool> MoveToPlayer(Message player, float range) { if (!ZetaDia.IsInGame || !player.IsInSameGame || !player.IsInSameWorld) { return(false); } if (player.Distance > range) { Log.Verbose("Moving to Player {0} CurrentDistance={1} DistanceRequired={2} ", player.HeroAlias, player.Distance, range); await MoveTo(() => AutoFollow.GetUpdatedMessage(player), player.HeroAlias, range, t => { if (!player.IsInSameWorld) { return(true); } if (t.Distance > Settings.Coordination.TeleportDistance && !RiftHelper.IsInGreaterRift) { return(true); } if (t.Distance < Settings.Coordination.CatchUpDistance && Targetting.RoutineWantsToAttackUnit()) { return(true); } return(false); }); return(true); } Log.Debug("Player {0} is close enough CurrentDistance={1} DistanceRequired={2} ", player.HeroAlias, player.Distance, range); return(true); }
public override void PlayCard(bool playedByAI) { base.PlayCard(playedByAI); if (!playedByAI) { Targetting targetting = Targetting.instance; targetting.SelectObjectAoE(0); targetting.currentCondition = Targetting.TargetCondition.isEnemyTile; } GuassCannonAction gca = new GuassCannonAction(); gca.actionName = "Scatter Shot"; gca.target = null; gca.damage = damageDealt; gca.actionType = 0; ResolutionPhase rP = ResolutionPhase.instance; rP.storedAttackAction = gca; }
// Use this for initialization void Start() { _e = GetComponent <Energy>(); _rb = GetComponent <Rigidbody2D>(); _v = GetComponent <Visibility>(); _t = GetComponent <Targetting>(); gameScript = GameObject.FindGameObjectWithTag("GameController").GetComponent <Game>(); playerMM = gameScript.player.GetComponent <ManagedMob>(); playerControl = gameScript.player.GetComponent <PlayerControl>(); // Shotgun or rifle? _t.accuracy = Random.Range(0.6f, 2); // Gung-ho with his bullets? fireRate = Random.Range(0.05f, 1); // Once he's tracking us, how close will he get? tooClose = Random.Range(3.0f, 4.0f); // a chutzpah <=0 means the captain will happily sit right in the player's firing line chutzpah = Random.Range(-10, 10); rendererTransform = transform.Find("Renderer"); MM = GetComponent <ManagedMob>(); crosshair = Instantiate(crosshairObject, transform.position, transform.rotation); cloak = GetComponent <Cloak>(); ChooseNewDestination(); enemyShootSound = GameObject.Find("EnemyShootSound").GetComponent <AudioSource>(); enemyBounceSound = GameObject.Find("EnemyBumpSound").GetComponent <AudioSource>(); enemyHitSound = GameObject.Find("EnemyHurtSound").GetComponent <AudioSource>(); if (Random.Range(0, 100) < bigBulletChance) { bigBullets = true; } }
// Update is called once per frame void Update() { if (wait > 0) { wait -= Time.deltaTime; } else { Vector3 direction = target.position - this.transform.position; direction.y = 0; direction.Normalize(); distance = (this.transform.position - target.position).magnitude; horizantal = distance / 1.7f; vertical = distance / 6f; transform.Rotate(new Vector3(1, 0, 0), armspeed * Time.deltaTime); timer += Time.deltaTime; if (timer >= time) { GameObject go = GameObject.Instantiate(Snowball.gameObject); go.transform.position = Spawnpoint.transform.position; Targetting myTarget = go.GetComponent <Targetting>(); if (myTarget != null) { myTarget.target = target; } go.GetComponent <Rigidbody>().AddForce(direction * horizantal + new Vector3(0, 1, 0) * vertical, ForceMode.Impulse); timer = -time; } } }
void ChangeTargettingMode(Targetting targettingMode) { targetting = targettingMode; TargetChange?.Invoke(this, new DataEventArgs <Targetting>(targettingMode)); }
void Awake() { targeting = GetComponent<Targetting>(); }
/// <summary> /// Turn combat (Trinity) on and off while the follower is far away from the leader. /// </summary> public void StayCloseToPlayer(Message player) { if (player.Distance > Math.Max(Settings.Coordination.FollowDistance + 15f, 40f) && !Player.IsInTown && !Navigation.IsBlocked && !Navigator.StuckHandler.IsStuck && Player.HitpointsCurrentPct > 0.7 && !Targetting.RoutineWantsToAttackGoblin()) { Targetting.State = CombatState.Pulsing; } else { Targetting.State = CombatState.Enabled; } }
public override async Task <bool> InGameTask() { // Returning True => go to next tick immediately, execution starts again from top of the tree. // Returning False => allow execution to continue to lower hooks. Such as profiles, Adventurer. if (await base.InGameTask()) { return(Repeat(PartyObjective.TownRun)); } if (await Party.LeaveWhenInWrongGame()) { return(Repeat(PartyObjective.LeavingGame)); } if (await Questing.UpgradeGems()) { return(Continue(PartyObjective.Quest)); } if (await Coordination.StartTownRunWithLeader()) { return(Continue(PartyObjective.Teleporting)); } if (await Coordination.WaitForGreaterRiftInProgress()) { return(Repeat(PartyObjective.TownRun)); } if (Targetting.RoutineWantsToLoot() || Targetting.RoutineWantsToClickGizmo()) { return(Continue(PartyObjective.None)); } if (await Coordination.LeaveFinishedRift()) { return(Repeat(PartyObjective.TownRun)); } if (await Coordination.FollowLeaderThroughPortal()) { return(Repeat(PartyObjective.FollowLeader)); } if (await Coordination.TeleportWhenInDifferentWorld(AutoFollow.CurrentLeader)) { return(Repeat(PartyObjective.Teleporting)); } if (await Coordination.TeleportWhenTooFarAway(AutoFollow.CurrentLeader)) { return(Repeat(PartyObjective.Teleporting)); } if (await FollowLeader()) { return(Continue(PartyObjective.FollowLeader)); } if (await Questing.ReturnToGreaterRift()) { return(Repeat(PartyObjective.TownRun)); } if (await Movement.MoveToGreaterRiftExitPortal()) { return(Repeat(PartyObjective.FollowLeader)); } return(false); }
void Awake() { instance = this; playerPhysics = GetComponent<PlayerPhysics>(); }
private void Start() { targetting = Targetting.instance; }
public override async Task <bool> InGameTask() { // Returning True => go to next tick immediately, execution starts again from top of the tree. // Returning False => allow execution to continue to lower hooks. Such as profiles, Adventurer. if (await base.InGameTask()) { return(true); } if (await Party.LeaveWhenInWrongGame()) { return(true); } if (await Questing.UpgradeGems()) { return(false); } if (await Coordination.StartTownRunWithLeader()) { return(false); } if (await Coordination.WaitForGreaterRiftInProgress()) { return(true); } if (await Questing.LeaveRiftWhenDone()) { return(true); } if (Targetting.RoutineWantsToLoot() || Targetting.RoutineWantsToClickGizmo()) { return(false); } if (await Coordination.FollowLeaderThroughPortal()) { return(true); } if (await Coordination.TeleportWhenInDifferentWorld(AutoFollow.CurrentLeader)) { return(true); } if (await Coordination.TeleportWhenTooFarAway(AutoFollow.CurrentLeader)) { return(true); } if (await Coordination.UseNearbyPortalWhenIdle()) { return(true); } if (await Movement.MoveToPlayer(AutoFollow.CurrentLeader, Settings.Coordination.FollowDistance)) { return(false); } if (await Questing.ReturnToGreaterRift()) { return(true); } //if (await Movement.MoveToGreaterRiftExitPortal()) // return true; return(false); }
/// <summary> /// Moves to an actor /// (blocks execution but heavily validated, combat use OK) /// </summary> /// <param name="targetableProducer">returns an updated ITargetable object</param> /// <param name="destinationName">friendly name of destination for logging purposes</param> /// <param name="range">acceptable distance to destination</param> /// <param name="stopCondition">optional condition that would cause movement to abort</param> /// <returns></returns> public async static Task <bool> MoveTo(Func <ITargetable> targetableProducer, string destinationName, float range, Func <ITargetable, bool> stopCondition) { if (targetableProducer == null) { return(false); } var target = targetableProducer(); var distance = 0f; var name = string.IsNullOrEmpty(destinationName) ? "Unknown" : destinationName; var destination = target.Position; var acdId = target.AcdId; Navigator.PlayerMover.MoveTowards(destination); var i = 0; while (ZetaDia.IsInGame) { if (ZetaDia.Me.IsDead || Navigator.StuckHandler.IsStuck) { break; } if (Navigation.IsBlocked) { Log.Verbose("Movement Failed, It looks like we're blocked!", name, distance); break; } var actor = Data.Actors.FirstOrDefault(p => p.ACDId == acdId); //if (actor == null) //{ // Log.Info("Player not found with ACDId {0}", acdId); //} target = targetableProducer(); if (target == null && actor == null) { Log.Verbose("Movement failed, Target not found", name, distance); return(false); } if (stopCondition != null && stopCondition(target ?? new Target())) { break; } if (target != null && target.WorldSnoId != Player.CurrentWorldSnoId) { Log.Verbose("Movement Failed, Target is in a different world", name, distance); return(false); } if (Player.IsIdle && !Navigation.CanRayCast(Player.Position, destination)) { Log.Verbose("Movement Failed, Unable to reach destination", name, distance); return(false); } if (EventManager.IsExecutionBreakRequested) { Log.Verbose("Movement Failed, Eventmanager requested execution to finish", name, distance); return(false); } if (Targetting.RoutineWantsToLoot()) { Log.Verbose("Movement Stopped, Combat routine wants to pick up an item.", name, distance); return(false); } if (Targetting.RoutineWantsToClickGizmo()) { Log.Verbose("Movement Stopped, Combat routine wants to pick up an item.", name, distance); return(false); } destination = actor != null ? actor.Position : target.Position; distance = destination.Distance(ZetaDia.Me.Position); if (distance <= range) { break; } Log.Verbose("Moving to {0} Distance={1} (Dynamic) ({2})", name, distance, i); MathEx.GetPointAt(ZetaDia.Me.Position, 15f, ZetaDia.Me.Movement.Rotation); await Navigator.MoveTo(destination, name); await Coroutine.Yield(); i++; } if (distance <= range) { Navigator.PlayerMover.MoveStop(); } Log.Verbose("MoveTo Finished. Distance={0}", distance); return(true); }
// assemblers private void Disassemble() { byte temp = 0; name = new char[15]; for (int i = 0; i < name.Length; i++) { name[i] = (char)rom[(index * 15) + 0x3A137F + i]; } if (index <= 0x1A) { description = ParseDescription(); } else { description = null; } // int offset = (index * 12) + 0x3A20F1; // temp = rom[offset++]; checkStats = (temp & 0x01) == 0x01; ignoreDefense = (temp & 0x02) == 0x02; checkMortality = (temp & 0x20) == 0x20; usableOverworld = (temp & 0x80) == 0x80; // temp = rom[offset++]; attackType = (byte)(temp & 0x01); switch (temp & 0x06) { case 0x02: effectType = 0; break; case 0x04: effectType = 1; break; default: effectType = 2; break; } maxAttack = (temp & 0x08) == 0x08; // fpCost = rom[offset++]; // Targetting target = (Targetting)rom[offset++]; targetLiveAlly = (target & Targetting.LiveAlly) == Targetting.LiveAlly; targetEnemy = (target & Targetting.Enemy) == Targetting.Enemy; targetAll = (target & Targetting.All) == Targetting.All; targetWoundedOnly = (target & Targetting.WoundedOnly) == Targetting.WoundedOnly; targetOnePartyOnly = (target & Targetting.OnePartyOnly) == Targetting.OnePartyOnly; targetNotSelf = (target & Targetting.NotSelf) == Targetting.NotSelf; // temp = rom[offset++]; switch (temp & 0xF0) { case 0x10: inflictElement = 0; break; // Ice case 0x20: inflictElement = 1; break; // Thunder case 0x40: inflictElement = 2; break; // Fire case 0x80: inflictElement = 3; break; // Earth default: inflictElement = 4; break; } magicPower = rom[offset++]; hitRate = rom[offset++]; // status effect Status status = (Status)rom[offset++]; effectMute = (status & Status.Mute) == Status.Mute; effectSleep = (status & Status.Sleep) == Status.Sleep; effectPoison = (status & Status.Poison) == Status.Poison; effectFear = (status & Status.Fear) == Status.Fear; effectMushroom = (status & Status.Mushroom) == Status.Mushroom; effectScarecrow = (status & Status.Scarecrow) == Status.Scarecrow; effectInvincible = (status & Status.Invincible) == Status.Invincible; // status change temp = rom[offset]; offset += 2; changeMagicAttack = (temp & 0x08) == 0x08; // Magic Attack changeAttack = (temp & 0x10) == 0x10; // Attack changeMagicDefense = (temp & 0x20) == 0x20; // Magic Defense changeDefense = (temp & 0x40) == 0x40; // Defense // temp = rom[offset++]; switch (temp) { case 0x00: inflictFunction = 0; break; // Ice case 0x01: inflictFunction = 1; break; // Ice case 0x02: inflictFunction = 2; break; // Thunder case 0x03: inflictFunction = 3; break; // Fire case 0x04: inflictFunction = 4; break; // Earth default: inflictFunction = 5; break; } hideDigits = rom[offset] == 4; // timing if (index < 32) { // timing + damage pointers offset = index * 2 + 0x02CACE; timingPointer = Bits.GetShort(rom, offset); switch (temp * 2) { case 0xCB0E: timingPointer = 0; break; // case 0xCBD8: timingPointer = 1; break; // case 0xCC44: timingPointer = 2; break; // case 0xCD1E: timingPointer = 3; break; // case 0xCD3F: timingPointer = 4; break; // case 0xCDA2: timingPointer = 5; break; // case 0xCDE1: timingPointer = 6; break; // case 0xCE75: timingPointer = 7; break; // case 0xCE85: timingPointer = 8; break; // case 0xCF22: timingPointer = 9; break; // case 0xCF63: timingPointer = 10; break; // case 0xCFC2: timingPointer = 11; break; // case 0xCFDF: timingPointer = 12; break; // default: break; //no check } offset = index * 2 + 0x02D05B; damagePointer = Bits.GetShort(rom, offset); } }
// Read/write ROM private void ReadFromROM() { // Name byte temp = 0; Name = new char[15]; for (int i = 0; i < Name.Length; i++) { Name[i] = (char)rom[(Index * 15) + 0x3A137F + i]; } // Description if (Index <= 0x1A) { RawDescription = ParseDescription(); } else { RawDescription = null; } #region Statistics int offset = (Index * 12) + 0x3A20F1; // Misc properties temp = rom[offset++]; CheckStats = (temp & 0x01) == 0x01; IgnoreDefense = (temp & 0x02) == 0x02; CheckMortality = (temp & 0x20) == 0x20; UsableOverworld = (temp & 0x80) == 0x80; // Type temp = rom[offset++]; AttackType = (byte)(temp & 0x01); switch (temp & 0x06) { case 0x02: EffectType = 0; break; case 0x04: EffectType = 1; break; default: EffectType = 2; break; } MaxAttack = (temp & 0x08) == 0x08; // FP cost FPCost = rom[offset++]; // Targetting Targetting target = (Targetting)rom[offset++]; TargetLiveAlly = (target & Targetting.LiveAlly) == Targetting.LiveAlly; TargetEnemy = (target & Targetting.Enemy) == Targetting.Enemy; TargetAll = (target & Targetting.All) == Targetting.All; TargetWoundedOnly = (target & Targetting.WoundedOnly) == Targetting.WoundedOnly; TargetOnePartyOnly = (target & Targetting.OnePartyOnly) == Targetting.OnePartyOnly; TargetNotSelf = (target & Targetting.NotSelf) == Targetting.NotSelf; // Inflict element temp = rom[offset++]; switch (temp & 0xF0) { case 0x10: InflictElement = 0; break; // Ice case 0x20: InflictElement = 1; break; // Thunder case 0x40: InflictElement = 2; break; // Fire case 0x80: InflictElement = 3; break; // Earth default: InflictElement = 4; break; } MagicPower = rom[offset++]; HitRate = rom[offset++]; // Status effect Status status = (Status)rom[offset++]; EffectMute = (status & Status.Mute) == Status.Mute; EffectSleep = (status & Status.Sleep) == Status.Sleep; EffectPoison = (status & Status.Poison) == Status.Poison; EffectFear = (status & Status.Fear) == Status.Fear; EffectMushroom = (status & Status.Mushroom) == Status.Mushroom; EffectScarecrow = (status & Status.Scarecrow) == Status.Scarecrow; EffectInvincible = (status & Status.Invincible) == Status.Invincible; // Status change temp = rom[offset]; offset += 2; ChangeMagicAttack = (temp & 0x08) == 0x08; // Magic Attack ChangeAttack = (temp & 0x10) == 0x10; // Attack ChangeMagicDefense = (temp & 0x20) == 0x20; // Magic Defense ChangeDefense = (temp & 0x40) == 0x40; // Defense // Inflict function temp = rom[offset++]; switch (temp) { case 0x00: InflictFunction = 0; break; // Ice case 0x01: InflictFunction = 1; break; // Ice case 0x02: InflictFunction = 2; break; // Thunder case 0x03: InflictFunction = 3; break; // Fire case 0x04: InflictFunction = 4; break; // Earth default: InflictFunction = 5; break; } HideDigits = rom[offset] == 4; #endregion #region Timing if (Index == 2) // super jump { MultipleSpellRanges = new byte[14]; for (int i = 0; i < 14; i++) { if (i == 0) { MultipleSpellRanges[i] = rom[0x35969D]; } else if (i == 13) { MultipleSpellRanges[i] = rom[0x359768]; } else { offset = ((i - 1) * 11) + 0x3596DE; MultipleSpellRanges[i] = rom[offset]; } } MultipleSpellMax = rom[0x359763]; } if (Index == 4) // ultra jump { MultipleSpellRanges = new byte[17]; for (int i = 0; i < 17; i++) { if (i == 0) { MultipleSpellRanges[i] = rom[0x359AA6]; } else if (i == 16) { MultipleSpellRanges[i] = rom[0x359B83]; } else { offset = ((i - 1) * 11) + 0x359AD7; MultipleSpellRanges[i] = rom[offset]; } } MultipleSpellMax = rom[0x359B7E]; } if (Index == 26) // star rain { MultipleSpellRanges = new byte[1]; MultipleSpellRanges[0] = rom[0x35C3C5]; MultipleSpellMax = rom[0x35C407]; } if (Index == 9 || Index == 17 || Index == 18 || Index == 21 || Index == 23) { if (Index == 9) { offset = 0x35A663; // Come Back } else if (Index == 17) { offset = 0x35B9DB; // Geno Boost } else if (Index == 18) { offset = 0x35BAE2; // Geno Whirl } else if (Index == 21) { offset = 0x35BEDA; // Thunderbolt } else if (Index == 23) { offset = 0x35C15E; // Psychopath } OneLevelSpellStart = rom[offset]; offset += 2; OneLevelSpellSpan = rom[offset]; offset += 2; } if (Index == 0 || Index == 6 || Index == 7 || Index == 14 || Index == 22 || Index == 24) { if (Index == 0) { offset = 0x359305; // Jump } else if (Index == 6 || Index == 7) { offset = 0x359E47; // Therapy / Group Hug } else if (Index == 14) { offset = 0x35B09A; // Crusher } else if (Index == 22) { offset = 0x35BFC6; // HP Rain } else if (Index == 24) { offset = 0x35C2CA; // Shocker } TwoLevelSpellStartLevel1 = rom[offset]; offset += 2; TwoLevelSpellStartLevel2 = rom[offset++]; TwoLevelSpellEndLevel2 = rom[offset++]; TwoLevelSpellEndLevel1 = rom[offset++]; } if (Index == 1 || Index == 3 || Index == 5) { if (Index == 1) { offset = 0x359484; // Fire Orb } else if (Index == 3) { offset = 0x3598D8; // Super Flame } else if (Index == 5) { offset = 0x359CF4; // Ultra Flame } FireballSpellRange = rom[offset]; offset += 13; FireballSpellOrbs = rom[offset]; } if (Index == 8 || Index == 10 || Index == 12 || Index == 13 || Index == 25) { if (Index == 8) { offset = 0x35A423; // Sleepy Time } else if (Index == 10) { offset = 0x35A86F; // Mute } else if (Index == 12) { offset = 0x35ACAF; // Terrorize } else if (Index == 13) { offset = 0x35AE3A; // Poison Gas } else if (Index == 25) { offset = 0x35C347; // Snowy } RotationSpellStart = rom[offset]; offset += 2; RotationSpellMax = rom[offset]; } if (Index == 16 || Index == 19 || Index == 20) { ChargeSpellStartLevel2 = rom[0x35B58D]; ChargeSpellStartLevel3 = rom[0x35B58E]; ChargeSpellStartLevel4 = rom[0x35B58F]; ChargeSpellOverflow = rom[0x35B590]; } if (Index == 11 || Index == 15) { RapidSpellMax = rom[0x35AA15]; } #endregion }
/// <summary> /// Moves to an actor /// (blocks execution but heavily validated, combat use OK) /// </summary> /// <param name="targetableProducer">returns an updated ITargetable object</param> /// <param name="destinationName">friendly name of destination for logging purposes</param> /// <param name="range">acceptable distance to destination</param> /// <param name="stopCondition">optional condition that would cause movement to abort</param> /// <returns></returns> public async static Task <bool> MoveTo(Func <ITargetable> targetableProducer, string destinationName, float range, Func <ITargetable, bool> stopCondition) { if (targetableProducer == null) { return(false); } var target = targetableProducer(); var distance = target.Distance; var name = string.IsNullOrEmpty(destinationName) ? "Unknown" : destinationName; var destination = target.Position; var acdId = target.AcdId; Navigator.PlayerMover.MoveTowards(destination); var i = 0; while (true) { if (!ZetaDia.IsInGame) { Log.Verbose("Movement Failed, we're no longer in game!", name, distance); break; } if (ZetaDia.Me.IsDead) { Log.Verbose("Movement Failed, we're dead!", name, distance); break; } if (Navigator.StuckHandler.IsStuck) { Log.Verbose("Movement Failed, It looks like we're stuck!", name, distance); break; } if (Navigation.IsBlocked) { Log.Verbose("Movement Failed, It looks like we're blocked!", name, distance); break; } var actor = Data.Actors.FirstOrDefault(p => p.ACDId == acdId); target = targetableProducer(); if (target == null && actor == null) { Log.Verbose("Movement failed, Target not found", name, distance); return(false); } if (stopCondition != null && stopCondition(target ?? new Target())) { break; } if (target != null && target.WorldDynamicId != Player.CurrentDynamicWorldId) { Log.Verbose("Movement Failed, Target is in a different world", name, distance); return(false); } if (Player.IsIdle && !Navigation.CanRayCast(Player.Position, destination)) { Log.Verbose("Movement Failed, Unable to reach destination", name, distance); return(false); } if (EventManager.IsExecutionBreakRequested) { Log.Verbose("Movement Failed, Eventmanager requested execution to finish", name, distance); return(false); } if (Targetting.RoutineWantsToLoot()) { Log.Verbose("Movement Stopped, Combat routine wants to pick up an item.", name, distance); return(false); } if (Settings.Combat.AllowAvoidance && Core.Avoidance.Avoider.ShouldAvoid) { Log.Verbose("Movement Stopped, Trinity wants to Avoid.", name, distance); return(false); } if (Settings.Combat.AllowKiting && Core.Avoidance.Avoider.ShouldKite) { Log.Verbose("Movement Stopped, Trinity wants to Kite.", name, distance); return(false); } if (Targetting.RoutineWantsToClickGizmo()) { Log.Verbose("Movement Stopped, Combat routine wants to click on a gizmo.", name, distance); return(false); } destination = actor?.Position ?? target.Position; distance = destination.Distance(ZetaDia.Me.Position); if (distance <= range) { break; } Log.Verbose("Moving to {0} Distance={1} (Dynamic) ({2})", name, distance, i); if (distance < 30f && Navigator.Raycast(Player.Position, destination)) { Navigator.PlayerMover.MoveTowards(destination); } else { var result = await Navigator.MoveTo(destination, name); switch (result) { case MoveResult.Failed: case MoveResult.PathGenerationFailed: Log.Verbose($"Failed Move Result = {result}"); break; } } await Coroutine.Yield(); i++; } if (distance <= range) { Navigator.PlayerMover.MoveStop(); return(true); } Log.Verbose("MoveTo Finished. Distance={0}", distance); return(true); }