public BattleActionResult.StatusEffectResult GetStatusEffectResult(BattleCharacter target, List<StatusEffect> allStatusEffects) { var result = new BattleActionResult.StatusEffectResult(); var landedEffects = new List<StatusEffect>(); var resistedCount = 0; var ineffectiveCount = 0; foreach (var statusEffect in allStatusEffects) { var resistance = target.GetStatusEffectResistance(statusEffect.StatusEffectType); if (!this.IsResisted(resistance)) { if (target.CanApplyStatusEffect(statusEffect)) { landedEffects.Add(statusEffect); } else { ineffectiveCount++; } } else { resistedCount++; } } result.landedEffects = landedEffects; result.resultType = this.GetStatusResultType(allStatusEffects.Count, resistedCount, ineffectiveCount); return result; }
public void Init(BattleCharacter character) { foreach (Transform child in _statsContainer) { Destroy(child.gameObject); } this._nameLabel.text = character.Name; this._hpBar.Init(character.HpPercentage); this._hpLabel.text = string.Format("{0}/{1}", character.CurrentHp, character.MaxHp); this.CreateCellWithDecimalValue(character, Const.Stats.Attack); this.CreateCellWithDecimalValue(character, Const.Stats.Defense); this.CreateCellWithDecimalValue(character, Const.Stats.Wisdom); this.CreateCellWithDecimalValue(character, Const.Stats.Agility); this.CreateCellWithDecimalValue(character, Const.Stats.Mind); this.CreateEmptyCell(); this.CreateCellWithPercentageValue(character, Const.Stats.Accuracy); this.CreateCellWithPercentageValue(character, Const.Stats.Evasion); this.CreateCellWithPercentageValue(character, Const.Stats.Critical); this.gameObject.SetActive(true); }
public void UpdateView(BattleCharacter battleCharacter) { if (battleCharacter == null) { return; } var list = battleCharacter.Enmity.GetEnmityList(); // reuse cells for (int i = 0; i < _cells.Count; ++i) { var cell = _cells[i]; BattleEnmity.EnmityTarget characterEnmity = null; if (i < list.Count) { characterEnmity = list[i]; cell.Setup(characterEnmity); cell.gameObject.SetActive(true); } else { cell.gameObject.SetActive(false); } } // create cells if we don't have enough if (list.Count > _cells.Count) { for (int i = _cells.Count; i < list.Count; ++i) { this.CreateCell(list[i]); } } }
public double CalculateDamage(BattleCharacter attacker, BattleCharacter defender, SkillEffect effect, bool shouldCritical) { var damage = 0d; if (effect.HasStatModifier(Const.Stats.Attack)) { var modifiedAtk = attacker.GetStatWithModifiers(Const.Stats.Attack, effect.StatsModifiers); damage += modifiedAtk.Value - defender.GetStat(Const.Stats.Defense); } if (effect.HasStatModifier(Const.Stats.Wisdom)) { var modifiedWis = attacker.GetStatWithModifiers(Const.Stats.Wisdom, effect.StatsModifiers); damage += modifiedWis.Value - defender.GetStat(Const.Stats.Mind); } if (effect.HasStatModifier(Const.Stats.Mind)) { damage += attacker.GetStatWithModifiers(Const.Stats.Mind, effect.StatsModifiers).Value; } if (shouldCritical) { damage *= Const.CriticalDamageMultiplier; } // damage value needs to be positive or zero at this point so a low atk doesn't heal a high def without going thru affinities damage = Math.Max(0d, damage); damage = ApplyAffinityBonuses(damage, defender, effect.Affinities); return Math.Floor(damage); }
private void ApplyEnmityToCharacters(BattleCharacter actor, SkillEffect effect, List<BattleCharacter> targets) { foreach (var target in targets) { this.ApplyEnmityToCharacter(actor, effect, target); } }
public static BattleUnitController CreateBattleUnit(BattleCharacter character) { var prefab = Resources.Load(character.BaseCharacter.ModelPath) as GameObject; var go = GameObject.Instantiate(prefab) as GameObject; var unitController = go.GetComponent<BattleUnitController>(); return unitController; }
public bool ShouldHit(BattleCharacter attacker, BattleCharacter defender, SkillEffect effect) { var modifiedStat = attacker.GetStatWithModifiers(Const.Stats.Accuracy, effect.StatsModifiers); var hitChance = modifiedStat.Value; var evaChance = modifiedStat.IsAbsolute ? 0d :defender.GetStat(Const.Stats.Evasion); return this.IsRandomCheckSuccess(hitChance - evaChance); }
private BattleActionResult.EffectOnTarget GetPoisonEffect(BattleCharacter target, double magnitude) { var effectOnTarget = new BattleActionResult.EffectOnTarget(); effectOnTarget.target = target; effectOnTarget.isSuccess = true; effectOnTarget.hpChange = -target.CurrentHp * magnitude; return effectOnTarget; }
private void CreateSkillButtons(BattleCharacter character) { for (int i = 0; i < character.BaseCharacter.Skills.Count; ++i) { var skill = character.BaseCharacter.Skills[i]; var menuItem = this.CreateMenuItem(); menuItem.Init(skill.Name, i, this.OnSkillSelect); } }
public int ApplyDefaultCooldownToCharacter_CharacterCooldownUpdatedCorrectly(double agi) { var character = this.CreateCharacterWithAgi(agi); var battleCharacter = new BattleCharacter(character, Const.Team.Player); var service = new TurnOrderService(); service.ApplyDefaultCooldownToCharacter(battleCharacter); return battleCharacter.ActionCooldown; }
private void CreateCell(BattleCharacter character) { var go = Instantiate(cellPrefab) as GameObject; var cell = go.GetComponent<TurnOrderCell>(); cell.Setup(character); cell.gameObject.SetActive(true); cell.transform.SetParent(this.layout.transform); cell.transform.localScale = Vector3.one; cells.Add(cell); }
public IEnumerator MoveUnitToMapPosition(BattleCharacter character, List<MapPosition> occupiedPositions) { var occupiedTiles = this.GetTiles(occupiedPositions); var targetPosition = this.GetCenterPosition(occupiedTiles); var unitController = this._battleUnits[character]; if (unitController != null) { yield return StartCoroutine(unitController.MoveToPosition(targetPosition)); } }
private bool Filter(bool inCombat, BattleCharacter battleCharacter) { if (!battleCharacter.IsValid || battleCharacter.IsDead || !battleCharacter.IsVisible || battleCharacter.CurrentHealthPercent <= 0f) { return false; } if (!battleCharacter.CanAttack) { return false; } if (this.IgnoreNpcIds.Contains(battleCharacter.NpcId)) { return false; } if (Blacklist.Contains(battleCharacter.ObjectId, BlacklistFlags.Combat)) { return false; } if (battleCharacter.IsFateGone) { return false; } if (Core.Player.IsLevelSynced && IsOutOfRangeOfLevelSyncedFate(battleCharacter)) { return false; } if (this.attackers.Contains(battleCharacter)) { return true; } if (!battleCharacter.IsFate && ExFateBot.FateData != null) { return false; } if (ExFateBot.FateData != null && battleCharacter.FateId != ExFateBot.FateData.Id) { return false; } if ((ExFateBot.FateData == null || !ExFateBot.FateData.IsValid)) { return false; } return !inCombat; }
public void CreateMenu(BattleCharacter character) { this.ShowMenu(true); this.ShowCancel(false); foreach (Transform child in _layout.transform) { Destroy(child.gameObject); } CreateSkillButtons(character); }
public int ApplySkillCooldownToCharacter_CharacterCooldownUpdatedCorrectly(double agi, int rank) { var character = this.CreateCharacterWithAgi(agi); var battleCharacter = new BattleCharacter(character, Const.Team.Player); var skill = this.CreateSkillWithRank(rank); var service = new TurnOrderService(); service.ApplySkillCooldownToCharacter(battleCharacter, skill); return battleCharacter.ActionCooldown; }
public double GetTotalHpChangeOnTarget(BattleCharacter target) { var total = 0d; foreach (var effectOnTarget in this.effectsOnTarget) { if (effectOnTarget.target == target) { total += effectOnTarget.hpChange; } } return total; }
public void ChangeEnmityLevel(BattleCharacter character, int enmityDelta) { foreach (var e in this._enmityList) { if (e.Character == character) { e.EnmityLevel += enmityDelta; break; } } this.ArrangeList(); }
/// <summary> /// Gets a position to cast a skill on so that the skill can hit the target character /// </summary> /// <returns>The position to hit character with skill.</returns> /// <param name="skill">Skill.</param> /// <param name="skillRadius">Skill radius.</param> /// <param name="target">Target.</param> /// <param name="sourceTeam">Source team.</param> /// <param name="map">The full map.</param> private MapPosition GetPositionToHitCharacterWithSkill(Skill skill, List<MapPosition> skillRadius, BattleCharacter target, Const.Team sourceTeam, Dictionary<MapPosition, Tile> map) { foreach (var mapPosition in skillRadius) { var targeting = skill.Effects[0].EffectTarget; var affectedPositions = ServiceFactory.GetMapService().GeMapPositionsForPattern(targeting.Pattern, targeting.TargetGroup, sourceTeam, map, mapPosition); if (affectedPositions.Intersect(target.OccupiedMapPositions).Count() > 0) { return mapPosition; } } return null; }
public void ApplyEnmityForSkillEffect(BattleCharacter actor, SkillEffect effect, List<BattleCharacter> affectedCharacters, List<BattleCharacter> allCharacters) { switch (effect.EnmityType) { case Const.EnmityTargetType.Target: this.ApplyEnmityToCharacters(actor, effect, affectedCharacters); break; case Const.EnmityTargetType.All: var targets = allCharacters.FindAll(x => x.Team != actor.Team); this.ApplyEnmityToCharacters(actor, effect, targets); break; } }
public async Task <bool> DhormeChimeraHandler(BattleCharacter c) { if (c.IsCasting && _theDragonsVoice.Contains(c.CastingSpellId)) { if (Core.Me.Distance2D(c) > 5f) { await CommonTasks.MoveAndStop(new ff14bot.Pathing.MoveToParameters(c.Location, "Dhorme Chimera"), 8f, true); return(true); } } return(false); }
/// <summary> /// Determines whether the combat routine is allowed to pull/do combat with the current target. /// </summary> /// <param name="target"></param> /// <returns></returns> private bool IsAllowedToFight(BattleCharacter target) { // Only limit when we have Smart Pull enabled, are not a tank ourselves and there is a tank nearby! if (Settings.BotBase.Instance.EnableSmartPull && !Core.Me.IsTank() && PartyManager.VisibleMembers.Any(member => member.IsTank())) { return(Core.Me.IsInMyParty() && target.IsEnemy() && target.HasBeenTaggedByPartyMember()); } return(true); }
public async Task <bool> CoincounterHandler(BattleCharacter c) { if (c.IsCasting && _eyeOfTheBeholder.Contains(c.CastingSpellId)) { if (Core.Me.Distance2D(c) > 7f) { await CommonTasks.MoveAndStop(new ff14bot.Pathing.MoveToParameters(c.Location, "Coincounter"), 7f, true); return(true); } } return(false); }
private static float HPScore(BattleCharacter c) { var score = c.CurrentHealthPercent; if (c.IsTank()) { score -= 5f; } if (c.IsHealer()) { score -= 3f; } return(score); }
/// <summary> /// Checks to see if the Object has any AuraId matching those in an Array of Ids. /// </summary> /// <param name="obj">The GameObject.</param> /// <param name="ids">The AuraIds to Check for.</param> /// <returns>True if the AuraId exists.</returns> public static bool HasAnyAura(BattleCharacter obj, params int[] ids) { int idCount = 0; foreach (uint id in ids) { if (obj.HasAura(id)) { idCount++; } } return(idCount > 0 ? true : false); }
public async Task <bool> SerYuhelmericHandler(BattleCharacter c) { if (c.IsCasting && _deathSpiral.Contains(c.CastingSpellId)) { if (Core.Me.Distance2D(c) > 5f) { await CommonTasks.MoveAndStop(new ff14bot.Pathing.MoveToParameters(c.Location, "Ser Yuhelmeric"), 5f, true); return(true); } } return(false); }
public GameObject Craete(Vector3 Pos, Transform parent, Quaternion Direct, BattleCharacter CCharacter) { GameObject targetObject; Acter targetActer; string CharacterPath = string.Format("PrePab/FriendPrepab/Friend{0}", CCharacter.Index); targetObject = (GameObject)Resources.Load(CharacterPath); targetActer = targetObject.transform.GetChild(0).GetComponent <FriendActor>(); targetActer.RegistCharacter(CCharacter); return(Instantiate(targetObject, Pos, Direct, parent)); }
public virtual void Init(BattleCharacter character, List <int> list) { _myself = character; for (int i = 0; i < list.Count; i++) { _skillList.Add(SkillFactory.GetNewSkill(list[i], _myself.Info, 1)); //等級填1是暫時的 } if (_skillList.Count > 0) { _myself.SelectedSkill = _skillList[0]; } }
public List <BattleCharacter> PlayerToFilter(BattleCommand battleCommand) { List <PlayerCharacter> playerCharacters = BattleController.instance.AlivePlayerCharacters; List <EnemyCharacter> enemyCharacters = BattleController.instance.AliveEnemyCharacters; BattleCharacter owner = battleCommand.owner; TargetType targetType = battleCommand.GetTargetType(); TargetUnit targetUnit = targetType.targetUnit; TargetRange targetRange = targetType.targetRange; IReadOnlyCollection <BattleCharacter> target = new List <BattleCharacter>(); switch (targetUnit) { case TargetUnit.自分: return(new List <BattleCharacter>() { owner }); case TargetUnit.味方: target = playerCharacters; break; case TargetUnit.相手: target = enemyCharacters; break; case TargetUnit.死亡者: target = playerCharacters.Where(x => x.IsDead()).ToList(); break; default: break; } switch (targetRange) { case TargetRange.単体: return(Randam(target)); case TargetRange.全体: return(target.Cast <BattleCharacter>().ToList()); default: break; } return(null); }
public static async Task <bool> WindBiteMultiDoT() { BattleCharacter windBiteMultiDoTTarget = null; if (Core.Me.ClassLevel < 64) { if (Core.Me.ClassLevel < 30 || !ActionManager.HasSpell(Spells.Windbite.Id)) { return(false); } if (BardSettings.Instance.MultiDotWindBiteUpToXEnemies != 0 && BardSettings.Instance.MultiDotWindBiteUpToXEnemies <= Combat.Enemies.Count(r => r.HasAura(Auras.Windbite, true))) { return(false); } windBiteMultiDoTTarget = Combat.Enemies.FirstOrDefault(r => IsValidTargetToApplyDoT(r, Auras.Windbite)); if (windBiteMultiDoTTarget == null) { return(false); } if (!await Spells.Windbite.Cast(windBiteMultiDoTTarget)) { return(false); } Logger.WriteInfo($@"[MultiDot] Windbite on {windBiteMultiDoTTarget.Name}"); return(true); } if (BardSettings.Instance.MultiDotWindBiteUpToXEnemies != 0 && BardSettings.Instance.MultiDotWindBiteUpToXEnemies <= Combat.Enemies.Count(r => r.HasAura(Auras.StormBite, true))) { return(false); } windBiteMultiDoTTarget = Combat.Enemies.FirstOrDefault(r => IsValidTargetToApplyDoT(r, Auras.StormBite)); if (windBiteMultiDoTTarget == null) { return(false); } if (!await Spells.Stormbite.Cast(windBiteMultiDoTTarget)) { return(false); } Logger.WriteInfo($@"[MultiDot] Stormbite on {windBiteMultiDoTTarget.Name}"); return(true); }
public void Scroll(BattleCharacter character) { foreach (KeyValuePair <BattleCharacter, PriorityQueueElement> item in _imageDic) { if (!_activeDic[item.Key]) { continue; } if (ReferenceEquals(character, item.Key)) { item.Value.gameObject.SetActive(false); _activeDic[item.Key] = false; } } }
private static int TpScore(BattleCharacter c) { var score = 0; if (c.IsTank()) { score += 100; } else if (c.CurrentTP <= MainSettingsModel.Instance.GoadTp) { score += 120; } return(score); }
/// <summary> /// Performs auto sprint if necessary. /// </summary> /// <param name="characterToWatch"></param> /// <returns></returns> private bool PerformAutoSprint(BattleCharacter characterToWatch) { if (characterToWatch == null) { return(false); } if (characterToWatch.HasAura(Constants.Aura.Sprint) && ActionManager.IsSprintReady) { LogHelper.Instance.Log("[{0}] Sprinting...", CallStackHelper.Instance.GetCaller()); ActionManager.Sprint(); return(true); } return(false); }
public void SelectAction(BattleCharacter src, BattleHand hand, BattleCharacters chars, Action <CardAction> onCardSelected) { _registerObj(Entity.Create("Player Card Select DropZone", new Transform2 { Size = new Size2(1920, 500) }) .Add(new MouseDropTarget { OnDrop = x => CompleteCardSelection(src, chars, x, onCardSelected) })); var margin = 20; var xLoc = 100; hand.Cards.ForEachIndex((x, i) => _registerObj( CardDisplay.Create(x, new Vector2(xLoc + i * (CardDisplay.Width + margin), 600), hand.Playable.Contains(x)))); }
/// <summary> /// Spawn a character row /// </summary> void SpawnCharacterRow(BattleCharacter battleCharacter) { // Spawn a prefab for the character row var characterRowPrefabPath = "Prefabs/Battle/CharacterListRow"; var characterRowGameObject = Resources.Load <GameObject>(characterRowPrefabPath); // Grab the parent panel for our character list var characterListPanel = GameObject.Find("CharacterListPanel"); // Spawn the character row var characterListRow = Instantiate(characterRowGameObject, characterListPanel.transform); // Set the character text characterListRow.transform.Find("NameText").GetComponent <Text>().text = battleCharacter.Name; }
private bool IsOutOfRangeOfLevelSyncedFate(BattleCharacter battleCharacter) { if (ExFateBot.FateData == null) { return(false); } // return true if distance from middle of fate to enemy is greater than var isOutOfRange = ExFateBot.FateData.Location.Distance(battleCharacter.Location) > (ExFateBot.FateData.Radius * 0.8f) // 80% of the fate radius plus + RoutineManager.Current.PullRange // player pull range from combat routine + battleCharacter.CombatReach; // distance(radius) from enemy in which your abilities calculate their distance. return(isOutOfRange); }
public BattleAction Use(BattleCharacter performer, BattleCharacter target) { if (this.type == Type.HEALTH) { return(new BattleAction { performer = performer, target = target, action = heal, message = string.Format("{0} heals {1}", performer.character.name, target.character.name) }); } else { return(new BattleAction { performer = performer, target = target, action = attack, message = name }); } }
// Use this for initialization void Start() { DataLoader dataLoader = new DataLoader(); DataController data = dataLoader.LoadData(); List <BattleCharacter> entities = data.GetBattleData(); for (int i = 0; i < entities.Count; i++) { BattleCharacter entity = entities[i]; // create player prefabs here SetupBattleCharacter(i, entity, spawnLocations[i]); // create AbilityBar prefabs here SetupAbilityBar(i, entity.abilities); } }
/// <summary> /// ボタンで取得したtarget情報をセット /// </summary> /// <param name="target">ターゲット</param> public void SetInputTarget(BattleCharacter target) { if (!target.IsAlive) { Debug.Log(target.CharaClass.CharaName + "は、倒れています"); return; } this.target = target; Debug.Log("target: " + target.CharaClass.CharaName); this.inputTargetWaiting = false; if (!target.IsEnemy) //ボタンの有効を敵に戻す { uiManager.SetActiveAllyTargetButtons(false); } }
[SerializeField] private StatesUIManager statesPrefab; // HP表示など public void CreateStatesUI(BattleCharacter chara, bool isplayer = false) { StatesUIManager states = Instantiate(statesPrefab); states.CHARACTER = chara; if (isplayer) { states.PlayerColor(); } else { states.EnemyColor(); } states.transform.SetParent(statesLayout.gameObject.transform, false); }
public static bool IsTank(Character c) { try { BattleCharacter bc = (BattleCharacter)c; //Logger.ATBLog("Character class:" + c.CurrentJob.ToString()+ "Character class is tank" + bc.IsTank()); return(bc.IsTank()); } catch (Exception ex) { //BadCasting this sux. return(false); } }
public void SetActionGroupVisible(bool isVisible) { ActionGroup.SetActive(isVisible); if (isVisible) { BattleCharacter character = BattleController.Instance.SelectedCharacter; ActionCountLabel.text = LanguageData.GetText(10, LanguageSystem.Instance.CurrentLanguage) + ":" + character.Info.ActionCount; //行動次數 SkillActionButton.interactable = !character.Info.HasUseSkill; SpellCardActionButton.interactable = !character.Info.HasUseSkill; ItemActionButton.interactable = !character.Info.HasUseSkill; UndoButton.interactable = character.CanUndoMove(); SetEscapeButton(); } }
public void looseBattle() { DestoryEnemyGUIs(); print("You lost"); isboss = false; targetCharacter = null; battleEnabled = false; foreach (BattleCharacter enemy in enemies) { Destroy(enemy.gameObject); } enemies.Clear(); ModeHandler.money = ModeHandler.money / 2; ModeHandler.modehandler.afterMenuSelect(); }
//効果の処理 private IEnumerator EffctExecution(BattleCommand battleCommand) { BattleCharacter owner = battleCommand.owner; List <BattleCharacter> targets = battleCommand.target; TargetUnit targetUnit = battleCommand.GetTargetType().targetUnit; PlayableAsset playableAsset = battleCommand.GetCommand().animation; var effects = battleCommand.GetEffect(); //効果の範囲が全体の場合 if (battleCommand.GetTargetType().targetRange == TargetRange.全体) { //敵キャラクタの行動はアニメション表示をしない if (owner is PlayerCharacter) { BattleDirectorController.Instance.AnimationPlay(playableAsset); } } foreach (var effect in effects) { //単体処理 foreach (var target in targets) { //ターゲットが存在しないとき新しいターゲットに変更する BattleCharacter newTarget = target; if (TargetUnit.死亡者 != targetUnit && target.IsDead()) { TargetFilter targetFilter = new TargetFilter(); newTarget = targetFilter.Auto(battleCommand); } //効果の処理 if (battleCommand.GetTargetType().targetRange == TargetRange.単体) { //敵キャラクタの行動はアニメション表示をしない if (owner is PlayerCharacter) { BattleDirectorController.Instance.AnimationPlay(playableAsset, newTarget.transform); } } effect.Use(owner, newTarget); //演出を再生する yield return(BattleDirectorController.Instance.Play()); } } yield break; }
// Start the battle (coroutine function). public IEnumerator StartBattleCo() { FadeTransition.selfReference.fadeToBlack(); GameManager.selfReference.battleActive = true; // Select a random battle. int selectedBattle = Random.Range(0, potentialBattles.Length); // Set the reward items for the battle. BattleManager.selfReference.rewardItems = potentialBattles[selectedBattle].rewardItems; yield return(new WaitForSeconds(1f)); BattleManager.selfReference.StartBattle(potentialBattles[selectedBattle].enemies, cannotRun); // Get a random enemy to calculate the true exp gained for each character. int randomEnemy = Random.Range(0, potentialBattles[selectedBattle].enemies.Length); BattleCharacter randomEnemyReference = null; for (int i = 0; i < BattleManager.selfReference.activeBattleCharacters.Count; i++) { if (BattleManager.selfReference.activeBattleCharacters[i].characterName == potentialBattles[selectedBattle].enemies[randomEnemy]) { randomEnemyReference = BattleManager.selfReference.activeBattleCharacters[i]; i = BattleManager.selfReference.activeBattleCharacters.Count; } } // Set the true exp gained for each character of the battle. for (int i = 0; i < BattleManager.selfReference.expGained.Length; i++) { if (PartyManager.selfReference.membersStats[i].gameObject.activeInHierarchy) { BattleManager.selfReference.expGained[i] = (potentialBattles[selectedBattle].expGained * randomEnemyReference.characterLevel) / PartyManager.selfReference.membersStats[i].characterLevel; } } FadeTransition.selfReference.fadeFromBlack(); if (deactivateAfterStart) { gameObject.SetActive(false); } BattleReward.selfReference.flagQuestCompleted = shouldCompleteQuest; BattleReward.selfReference.questToFlag = questToComplete; }
/// <summary> Query if 'unit' is valid unit. </summary> /// <remarks> Nesox, 2013-06-29. </remarks> private bool IsValidUnit(bool incombat, BattleCharacter unit) { if (!unit.IsValid || unit.IsDead || !unit.IsVisible || unit.CurrentHealthPercent <= 0) { return(false); } if (IgnoreNpcIds.Contains(unit.NpcId)) { return(false); } // Ignore blacklisted mobs if they're in combat with us! if (Blacklist.Contains(unit.ObjectId, BlacklistFlags.Combat)) { return(false); } var fategone = unit.IsFateGone; if (fategone) { return(false); } //Make sure we always return true for units inside our aggro list if (_aggroedBattleCharacters.Contains(unit)) { return(true); } if (!unit.IsFate) { return(false); } if (!unit.CanAttack) { return(false); } if (Vector3.Distance(unit.Location, LLFate.Position) > 50) { return(false); } return(!incombat); }
public override void SetEffect(BattleCharacter target, Dictionary <BattleCharacter, List <FloatingNumberData> > floatingNumberDic) { _floatingNumberDic = floatingNumberDic; BattleCharacter myself = BattleController.Instance.GetCharacterByPosition(_user.Position); SetFloatingNumberDic(myself, FloatingNumber.Type.Other, Data.Name); CheckSubSkill(target, HitType.Hit); //Timer timer = new Timer(Data.ShowTime / 2f, () => //{ // BattleCharacter myself = BattleController.Instance.GetCharacterByPosition(_user.Position); // BattleUI.Instance.SetFloatingNumber(myself, Data.Name, FloatingNumber.Type.Other); // CheckSubSkill(target, HitType.Hit); //}); }
public MapPosition SelectDefaultTargetForSkill(BattleCharacter actor, Skill selectedSkill, List<MapPosition> skillRadius, List<BattleCharacter> characters, Dictionary<MapPosition, Tile> map) { // TODO: better select default target logic. Save last target maybe var targetTeam = this.GetPreferredSkillTargetTeam(selectedSkill.Effects[0], actor.Team); foreach (var character in characters.FindAll( x => x.Team == targetTeam)) { var position = this.GetPositionToHitCharacterWithSkill(selectedSkill, skillRadius, character, actor.Team, map); if (position != null) { return position; } } return null; }
public void SpawnUnit(BattleCharacter character) { var tiles = this.GetTiles(character.OccupiedMapPositions); var position = this.GetCenterPosition(tiles); var battleUnit = BattleUnitFactory.CreateBattleUnit(character); battleUnit.transform.position = position; if (character.Team == Const.Team.Enemy) { battleUnit.transform.Rotate(new Vector3(0f, 180f, 0f)); } battleUnit.transform.SetParent(this.transform); battleUnit.Init(character); this._battleUnits.Add(character, battleUnit); }
public override List <AnimCallBackEntity> GetCallBacks() { List <AnimCallBackEntity> res = new List <AnimCallBackEntity>(); //动作结束回到站立 动作回调 res.Add(new AnimCallBackEntity("Enemy1_Attack", "FinishedToIdle", 1.0f, AnimEventParamType.Null)); //exitime 1.0 res.Add(new AnimCallBackEntity("Enemy1_BeAttacked", "FinishedToIdle", 1.0f, AnimEventParamType.Null)); //exitime 1.0 res.Add(new AnimCallBackEntity("Enemy1_Up", "FinishedToIdle", 0.8f, AnimEventParamType.Null)); //exitime 0.85 //声音回调 res.Add(new AnimCallBackEntity("Enemy1_Attack", "AttackSound", 0.35f, AnimEventParamType.String, "Enemy1_Attack|1.0")); //攻击判定 BattleCharacter bc = BattleController.Instance.GetBattleCharacter(GetCharacterId()); res.Add(new AnimCallBackEntity("Enemy1_Attack", "AttackJudge", 0.4f, AnimEventParamType.Int, bc.skill1_id)); //int skill id return(res); }
void checkEnchantedAttack(BattleCharacter actor, Effect effect) { //エンチャントファイアによる追加攻撃 //エンチャントファイア状態を持ってて魔法攻撃でないなら追加攻撃 //この効果を使うのは自分のみなのでActorTypeにPLAYERを決め撃ちしてる if (actor.hasBuff(Buff.BuffID.ENCHANT_FIRE) && !effect.hasAttribute(Effect.Attribute.MAGIC)) { List <Effect.Attribute> attributes = new List <Effect.Attribute>() { Effect.Attribute.MAGIC, Effect.Attribute.FIRE }; Effect fire = new Effect("響火起動", Effect.TargetType.TARGET_SINGLE_RANDOM, 65, Effect.EffectType.DAMAGE, 30, attributes); PlayableEffect pe = new PlayableEffect(fire, ActorType.PLAYER, 0); effectList.AddFirst(pe); } }
public void playDamageEffect(int damage, bool isMagic, BattleCharacter target) { DamageEffect createdDamageEffect = Instantiate(damageEffect, target.transform); createdDamageEffect.set(damage, isMagic); createdDamageEffect.transform.position = target.transform.position; target.playDamageAnimation(); if (damage >= 100) { target.setEmotion("critical", 60); } else { target.setEmotion("damage", 60); } }
public void LoadTechniques(BattleCharacter character) { battleTechniques = new List<BattleTechnique>(); menuOptions = new List<MenuOption>(); currentMenuOption = null; defaultMenuOption = null; foreach (BattleTechnique battleTechnique in character.Techniques) { if (battleTechnique.techniqueName != "Attack" && battleTechnique.techniqueName != "Defend") { MenuOption option = new MenuOption(battleTechnique.techniqueName, battleTechnique.techniqueDescription, Color.Yellow, Color.White, "blank", "blank"); AddMenuOption(option, (menuOptions.Count == 0)); battleTechniques.Add(battleTechnique); } } }
public void AddPostActionEffect(BattleActionResult actionResult, BattleCharacter target) { foreach (var specialStateEffect in target.SpecialStateModifiers) { var totalHpChangeOnTarget = actionResult.GetTotalHpChangeOnTarget(target); var isTargetAlive = (target.CurrentHp + totalHpChangeOnTarget) > 0; switch (specialStateEffect.Key) { case StatusEffect.Type.Poison: if (isTargetAlive) { actionResult.AddPostActionEffectResult(this.GetPoisonEffect(target, specialStateEffect.Value.StatModifier.Magnitude)); } break; default: break; } } }
public bool IsCharacterAffected(BattleCharacter character) { foreach (var effectResult in this.allSkillEffectResult) { foreach (var targetResult in effectResult.effectsOnTarget) { if (targetResult.target == character) { return true; } } } return false; }
private double GetScoreForMember(BattleCharacter c) { throw new NotImplementedException(); }
public double GetTotalHpChangeOnTarget(BattleCharacter target) { var total = 0d; foreach (var skillEffect in this.allSkillEffectResult) { total += skillEffect.GetTotalHpChangeOnTarget(target); } if (this.PostActionEffectResult != null) { total += this.PostActionEffectResult.GetTotalHpChangeOnTarget(target); } return total; }
private void ApplyEnmityToCharacter(BattleCharacter actor, SkillEffect effect, BattleCharacter target) { // TODO: better enmity calculation logic var enmityDelta = effect.BaseEnmity; target.Enmity.ChangeEnmityLevel(actor, enmityDelta); }
internal static async Task<bool> CastHeal(SpellData Spell, BattleCharacter o) { if (o == null || !o.IsValid) return false; if (!Actionmanager.CanCast(Spell, o)) { return false; } if (Spell.GroundTarget) { if (!Actionmanager.DoActionLocation(Spell.Id, o.Location)) return false; } if (Actionmanager.DoAction(Spell, o)) { await SleepForLagDuration(); Logging.Write(Colors.Orchid, "[YourRaidingBuddy] Casting {0}", Spell); if(InternalSettings.Instance.General.Debug) Logging.Write(Colors.AliceBlue, "[YourRaidingBuddy] Have Selected {0} because it needs healing {1}", HealTargeting.Instance.FirstUnit, HealTargeting.Instance.FirstUnit.CurrentHealthPercent); return true; } return false; }
void CommandValidationManagement(BattleCommandAction.commandActionType actionType) { switch(actionType) { case BattleCommandAction.commandActionType.attack: if (enemyList.Length > 0) selectedTarget = enemyList[0]; else selectedTarget = playerList[0]; battleState = BattleState.playerChoosingAtkTarget; break; case BattleCommandAction.commandActionType.skill: //Activer le menu skills SkillSelect(); break; case BattleCommandAction.commandActionType.summon: //Invoque les Gardiens en combat! break; case BattleCommandAction.commandActionType.defend: Debug.Log("DEFENSE!"); //Creer un defend factor pour le tour -> force*defendFactor pendant l'attaque, 0.5 ou 1, réinitialiser au début de chaque tour pour chaque perso, ennemi comme allié selectedPlayer.defending = true; break; case BattleCommandAction.commandActionType.escape: //Mettre fin au combat en fonction d'on ne sait pas encore quoi break; } }
public void Init(BattleCharacter character) { this.hpBar.Init(character.HpPercentage); this.defaultRotation = this.transform.localEulerAngles; this.characterView.onDamageAnimationComplete += this.OnDamageAnimationComplete; }