public void OnEnter() { Console.Clear(); location = gameMap.GetLocation(playerSystem.GetCurrentLocation(playerSystem.CurrentPlayer)); instance = new CombatInstance(lua, combatSystem); List<IRDSObject> enemy = location.GetEnemy().ToList(); if (enemy.Count == 0) OnEnter(); for (int i = 0; i < enemy.Count; i++) { if (!(enemy[i] is Entity)) continue; AddEntityToCombat((Entity)enemy[i], playerSystem.CurrentPlayer); } Console.ReadKey(); instance.AddEntity(playerSystem.CurrentPlayer); combatSystem.Heal(playerSystem.CurrentPlayer, StatType.CUR_STAMINA, combatSystem.GetCurrentStat(playerSystem.CurrentPlayer, StatType.MAX_STAMINA)); }
public void ChooseAction(ulong id, AIStat aiStat, CombatInstance instance) { ulong[] actions = aInventorySystem.GetHand(id); if (actions == null) return; int count = 4; List<ulong> canUse = new List<ulong>(); for (int i = 0; i < count; i++) { if (actions[i] != 0) if (CanPerform(id, actions[i])) canUse.Add(actions[i]); } count = canUse.Count; if (count == 0) return; ShuffleBag<ulong> actionBag = new ShuffleBag<ulong>(); for (int i = 0; i < count; i++) { string s = actionSystem.GetActionKey(canUse[i]); switch (aiStat) { case AIStat.AGGRESSION: actionBag.Add(canUse[i], (int)actionSystem.GetAggression(s)); break; case AIStat.BALANCE: actionBag.Add(canUse[i], (int)actionSystem.GetBalance(s)); break; case AIStat.DEFENSE: actionBag.Add(canUse[i], (int)actionSystem.GetDefense(s)); break; } } PerformAction(id, actionBag.Next(), instance); }
public void Update(ulong id, double deltaTime, CombatInstance instance) { statsSystem.Heal(id, StatType.CUR_STAMINA, 2); aiSystem.Update(id, deltaTime, instance); effectSystem.Update(id, deltaTime); }
public void PerformAction(ulong id, ulong action, CombatInstance instance) { for (int i = 0; i < GetCurrentStat(id, StatType.MAX_HAND); i++) { if (aInventorySystem.GetHand(id)[i] == action) { PayUseCost(id, action); aInventorySystem.PlayFromHandToGraveyard(id, i); break; } } string s = actionSystem.GetActionKey(action); string actionPath = actionSystem.GetPath(s); if (!instance.SkillUsed(id, s)) return; List<ulong> target = GetTarget(id, actionSystem.GetNumberOfTargets(s), actionSystem.GetAoE(s)); if (target == null) return; for (int i = 0; i < target.Count; i++) actionSystem.Execute(id, target[i], s); }