public void InitWindUp(HeldEquipment _prop, WeaponStyle _weaponStyle, int _windUpDepth) { type = CombatActionType.WindUp; prop = _prop; weaponStyle = _weaponStyle; windUpLevel = _windUpDepth; }
public override void FixedUpdate() { base.FixedUpdate(); if (isReadyNextATK) { int action = Random.Range(0, 3); _actionType = (CombatActionType)action; switch (_actionType) { case CombatActionType.HeavyAttack: HeavyAttack(); break; case CombatActionType.LightAttack: LightAttack(); break; case CombatActionType.Defend: Defend(); break; } } ResetAttackCD(); if (_fieldOfView.DistanceToPlayer > 5) { _sm._CurState = new IdleState(_go, _sm, _attributes, _animator); } }
private CombatActionModel applyRegenAbilityEffectToCombatant(AbilityEffectType abilityEffectType, int abilityID, int abilityCombatantOwnerID, int abilityAmount, CombatantModel combatantModel, int turnsRemaining, bool isCrit) { // Don't consider stat modifiers for regen abilities (if an enemy casts increased spell damage on you, // we don't want it to boost the healing you receive) CombatActionType combatActionType = CombatActionType.None; switch (abilityEffectType) { case AbilityEffectType.HealthRegen: combatantModel.SetCurrentHealth(combatantModel.CurrentHealth + abilityAmount); combatActionType = CombatActionType.RegenHealth; break; case AbilityEffectType.ManaRegen: combatantModel.SetCurrentMana(combatantModel.CurrentMana + abilityAmount); combatActionType = CombatActionType.RegenMana; break; default: throw new Exception("Invalid AbilityEffectType"); } return(new CombatActionModel(abilityCombatantOwnerID, combatActionType, abilityID, combatantModel.ID, abilityAmount, turnsRemaining, isCrit)); }
public AttackerAction(CombatActionType type, Creature creature, SkillId skillId, long targetId) { this.Type = type; this.Creature = creature; this.SkillId = skillId; this.TargetId = targetId; }
private CombatActionModel applyDamageAbilityEffectToCombatant(AbilityEffectType abilityEffectType, int abilityID, int abilityCombatantOwnerID, int abilityAmount, CombatantModel combatantModel, int turnsRemaining, bool isCrit) { StatModifiersDeltas statModifiersDeltas = combatantModel.StatModifiersDeltas; CombatActionType combatActionType = CombatActionType.None; int damageDeltaWithStatModifiers = 0; switch (abilityEffectType) { case AbilityEffectType.MeleeDamage: damageDeltaWithStatModifiers = getDamageDeltaWithStatMod(statModifiersDeltas.ArmorStatModifiersDelta, abilityAmount); combatActionType = CombatActionType.ReceiveMeleeDamage; break; case AbilityEffectType.SpellDamage: damageDeltaWithStatModifiers = getDamageDeltaWithStatMod(statModifiersDeltas.SpellResistStatModifiersDelta, abilityAmount); combatActionType = CombatActionType.ReceiveSpellDamage; break; default: throw new Exception("Invalid AbilityEffectType"); } combatantModel.SetCurrentHealth(combatantModel.CurrentHealth + damageDeltaWithStatModifiers); Logging.Log.Info("Combatant ID : " + combatantModel.ID + " on team " + combatantModel.TeamID + " receives damage: " + damageDeltaWithStatModifiers + ". New health = " + combatantModel.CurrentHealth); return(new CombatActionModel( abilityCombatantOwnerID, combatActionType, abilityID, combatantModel.ID, damageDeltaWithStatModifiers, turnsRemaining, isCrit)); }
public AttackerAction(CombatActionType type, Creature creature, SkillId skillId, long targetId) { this.Type = type; this.Creature = creature; this.SkillId = skillId; this.TargetId = targetId; }
/// <summary> /// Creates new target action. /// </summary> /// <param name="type"></param> /// <param name="creature"></param> /// <param name="attacker"></param> /// <param name="attackerSkillId"></param> public TargetAction(CombatActionType type, Creature creature, Creature attacker, SkillId attackerSkillId) { this.Flags = type; this.Creature = creature; this.Attacker = attacker; this.AttackerSkillId = attackerSkillId; // The target's skill id is 'CombatMastery' if no skill is loaded, // 'None' if a skill is currently being loaded, and equal to the // loaded skill if it's ready. var activeSkill = creature.Skills.ActiveSkill; if (activeSkill == null) { this.SkillId = SkillId.CombatMastery; } else if (activeSkill.State != SkillState.Ready) { this.SkillId = SkillId.None; } else { this.SkillId = activeSkill.Info.Id; } }
/// <summary> /// Creates new attacker action. /// </summary> /// <param name="type"></param> /// <param name="creature"></param> /// <param name="targetId"></param> /// <param name="skillId"></param> public AttackerAction(CombatActionType type, Creature creature, long targetId, SkillId skillId) { this.Flags = type; this.Creature = creature; this.TargetId = targetId; this.WeaponParameterType = 1; this.SkillId = skillId; }
public void InitParry(HeldEquipment _prop, WeaponStyle _weaponStyle, int _windUpDepth, int _offBalance) { type = CombatActionType.Parry; prop = _prop; weaponStyle = _weaponStyle; windUpLevel = _windUpDepth; offBalance = _offBalance; }
/// <summary> /// Creates new attacker action. /// </summary> /// <param name="type"></param> /// <param name="creature"></param> /// <param name="targetId"></param> /// <param name="skillId"></param> public AttackerAction(CombatActionType type, Creature creature, long targetId, SkillId skillId) { this.Flags = type; this.Creature = creature; this.TargetId = targetId; this.WeaponParameterType = 1; this.SkillId = skillId; }
public TargetAction(CombatActionType type, Creature creature, Creature attacker, SkillId skillId) { this.Flags = type; this.Creature = creature; this.Attacker = attacker; this.SkillId = skillId; this.AttackerSkillId = skillId; }
public void InitSwing(HeldEquipment _prop, WeaponStyle _weaponStyle, List <Vector2> _targetArea, int _windUpDepth) { type = CombatActionType.Swing; prop = _prop; weaponStyle = _weaponStyle; targetArea = _targetArea; windUpLevel = _windUpDepth; }
public void AddTargetAction(MabiCreature target, CombatActionType targetType, MabiCreature attacker = null, SkillConst skillId = SkillConst.None) { var tAction = new TargetAction(targetType, target, attacker == null ? this.AttackerAction.Creature : attacker, skillId == SkillConst.None ? this.AttackerAction.SkillId : skillId); this.TargetActions.Add(tAction); this.CurrentTargetAction = tAction; }
/// <summary> /// Creates new attacker action, setting SkillId to the currently /// active skill. /// </summary> /// <param name="type"></param> /// <param name="creature"></param> /// <param name="targetId"></param> public AttackerAction(CombatActionType type, Creature creature, long targetId) { this.Flags = type; this.Creature = creature; this.TargetId = targetId; this.WeaponParameterType = 1; var active = creature.Skills.ActiveSkill; this.SkillId = (active == null ? SkillId.CombatMastery : active.Info.Id); }
/// <summary> /// Creates new attacker action, setting SkillId to the currently /// active skill. /// </summary> /// <param name="type"></param> /// <param name="creature"></param> /// <param name="targetId"></param> public AttackerAction(CombatActionType type, Creature creature, long targetId) { this.Flags = type; this.Creature = creature; this.TargetId = targetId; this.WeaponParameterType = 1; var active = creature.Skills.ActiveSkill; this.SkillId = (active == null ? SkillId.CombatMastery : active.Info.Id); }
/// <summary> /// Creates new target action. /// </summary> /// <param name="type"></param> /// <param name="creature"></param> /// <param name="attacker"></param> /// <param name="attackerSkillId"></param> public TargetAction(CombatActionType type, Creature creature, Creature attacker, SkillId attackerSkillId) { this.Flags = type; this.Creature = creature; this.Attacker = attacker; this.AttackerSkillId = attackerSkillId; var active = creature.Skills.ActiveSkill; this.SkillId = (active == null ? SkillId.CombatMastery : active.Info.Id); }
public CombatActionModel( int casterCombatantID, CombatActionType combatActionType, int abilityID, int targetCombatantID, int amount, int turnsRemaining, bool isCrit) { CasterCombatantID = casterCombatantID; CombatActionType = combatActionType; AbilityID = abilityID; TargetCombatantID = targetCombatantID; Amount = amount; TurnsRemaining = turnsRemaining; IsCrit = isCrit; }
public override void FixedUpdate() { base.FixedUpdate(); if (isReadyNextATK) { int action = Random.Range(0, 2); _actionType = (CombatActionType)action; switch (_actionType) { case CombatActionType.HeavyAttack: // DoHeavyAttack(); DoLightAttack(); break; case CombatActionType.LightAttack: DoLightAttack(); break; } } ResetAttackCD(); _attackStateCountDown -= Time.fixedDeltaTime; if (_attackStateCountDown <= 0) { int action = Random.Range(0, 2); if (action == 0) { _sm._CurState = new CombatWalk(_go, _sm, false); } else { _sm._CurState = new BlockingState(_go, _sm); } } if (Vector3.Distance(_playerTransform.position, _go.transform.position) > 3f) { _sm._CurState = new FollowState(_go, _sm); } }
public void InitBlock(HeldEquipment _prop, int _offBalance) { type = CombatActionType.Block; prop = _prop; offBalance = _offBalance; }
/// <summary> /// Creates new target action. /// </summary> /// <param name="type"></param> /// <param name="creature"></param> /// <param name="attacker"></param> /// <param name="attackerSkillId"></param> public TargetAction(CombatActionType type, Creature creature, Creature attacker, SkillId attackerSkillId) { this.Flags = type; this.Creature = creature; this.Attacker = attacker; this.AttackerSkillId = attackerSkillId; // The target's skill id is 'CombatMastery' if no skill is loaded, // 'None' if a skill is currently being loaded, and equal to the // loaded skill if it's ready. var activeSkill = creature.Skills.ActiveSkill; if (activeSkill == null) this.SkillId = SkillId.CombatMastery; else if (activeSkill.State != SkillState.Ready) this.SkillId = SkillId.None; else this.SkillId = activeSkill.Info.Id; }
public void InitSwitchStyle(HeldEquipment _prop, int _windUpDepth) { type = CombatActionType.SwitchStyle; prop = _prop; windUpLevel = _windUpDepth; }
public void TriggerAction(CombatActionType actionType, CombatOperation action) { ActionTrigger.TriggerAction(actionType, action); }
/// <summary> /// Returns true if the specified flags are set. /// </summary> /// <param name="flags"></param> /// <returns></returns> public bool Is(CombatActionType flags) { return(flags == this.Flags || (flags != CombatActionType.None && (this.Flags & flags) != 0)); }
public void SetAttackerAction(MabiCreature attacker, CombatActionType type, SkillConst skillId, ulong targetId) { if (this.AttackerAction != null) throw new InvalidOperationException("An attacker may only be set once!"); this.AttackerAction = new AttackerAction(type, attacker, skillId, targetId); }
public void RemoveListener(CombatActionType actionType, Action <CombatAction> action) { CombatActions[actionType] -= action; }
public void RemoveListener(CombatActionType actionType, Action <CombatAction> action) { ActionTrigger.RemoveListener(actionType, action); }
public void AddListener(CombatActionType actionType, Action <CombatAction> action) { ActionTrigger.AddListener(actionType, action); }
/// <summary> /// Creates new target action. /// </summary> /// <param name="type"></param> /// <param name="creature"></param> /// <param name="attacker"></param> /// <param name="attackerSkillId"></param> public TargetAction(CombatActionType type, Creature creature, Creature attacker, SkillId attackerSkillId) { this.Flags = type; this.Creature = creature; this.Attacker = attacker; this.AttackerSkillId = attackerSkillId; var active = creature.Skills.ActiveSkill; this.SkillId = (active == null ? SkillId.CombatMastery : active.Info.Id); }
public TargetAction(CombatActionType type, MabiCreature creature, MabiCreature attacker, SkillConst skillId) { this.Type = type; this.Creature = creature; this.Attacker = attacker; this.SkillId = skillId; }
/// <summary> /// Returns true if the given type equals the combat action's type. /// </summary> /// <param name="type"></param> /// <returns></returns> public bool Is(CombatActionType type) { return(this.Type == type); }
public void CallAction(CombatActionType actionType, CombatAction action) { CombatActions[actionType]?.Invoke(action); }
public void CallAction(CombatActionType actionType, CombatAction action) { ActionTrigger.CallAction(actionType, action); }
public void AddListener(CombatActionType actionType, Action <CombatAction> action) { CombatActions[actionType] += action; }
public void InitRecover(int _offBalance) { type = CombatActionType.Recover; offBalance = _offBalance; }
private void processCombatantBehaviour(CombatantModel combatantModel) { // Advance all ability cooldowns for (int i = 0; i < combatantModel.AbilityItemModels.Length; i++) { combatantModel.AbilityItemModels[i].CoolDownTurnsElapsed++; } AbilityItemModel combatAbility = null; targets.Clear(); CombatActionModel combatActionModel = combatantModelToBehaviour[combatantModel].GetCombatAction(out combatAbility, ref targets); // If waiting, return if (combatActionModel.CombatActionType == CombatActionType.Wait) { return; } // if starting or canceling cast, append CombatActionModel and return if (combatActionModel.CombatActionType == CombatActionType.StartCastingAbility || combatActionModel.CombatActionType == CombatActionType.CancelCastingAbility) { combatActionsCollection[combatantModel.ID].Add(combatActionModel); return; } if (combatActionModel.CombatActionType != CombatActionType.ApplyAbility) { throw new Exception("Unexpected CombatActionType: " + combatActionModel.CombatActionType.ToString()); } // Append cast completion CombatActionModel combatActionsCollection[combatantModel.ID].Add(combatActionModel); // Restart ability cooldown combatAbility.CoolDownTurnsElapsed = 0; // Apply ability to targets and keep track of CombatActionModels bool isAbilityFriendly = combatAbility.IsFriendly(); for (int t = 0; t < targets.Count; t++) { CombatActionModel combatActionOnTarget; if (combatAbility.AbilityDurationType == AbilityDurationType.Immediate) // Handle ability with IMMEDIATE effect. { bool isCrit; int immediateAmountWithStatMods = getAbilityAmountWithStatMods(combatantModel, combatAbility.ImmediateAmout, combatAbility.IsSpellBased, out isCrit); if (isAbilityFriendly) { combatActionOnTarget = applyRegenAbilityEffectToCombatant(combatAbility.AbilityEffectType, combatAbility.ID, combatantModel.ID, immediateAmountWithStatMods, targets[t], 0, isCrit); } else { combatActionOnTarget = applyDamageAbilityEffectToCombatant(combatAbility.AbilityEffectType, combatAbility.ID, combatantModel.ID, immediateAmountWithStatMods, targets[t], 0, isCrit); } } else // Handle ability with DURATION effect { AbilityDurationData abilityDurationDataClone = combatAbility.AbilityDurationData.Clone(true); if (combatAbility.IsStatModifier()) { // Stat modifiers don't consider other stat modifiers. Ex: (if target has spell effect/damage debuff from // another modifier, we dont want another spell dmg debuff to cause exponential damage). targets[t].StatModifiersDeltas.AddModifier(abilityDurationDataClone.PerTickAmount, abilityDurationDataClone.AbilityEffectType); targets[t].StatModifierAbilityDurations.Add(abilityDurationDataClone); CombatActionType combatActionType = isAbilityFriendly ? CombatActionType.StatIncreasedByDurationAbility : CombatActionType.StatDecreasedByDurationAbility; combatActionOnTarget = new CombatActionModel( combatantModel.ID, combatActionType, combatAbility.ID, targets[t].ID, abilityDurationDataClone.PerTickAmount, abilityDurationDataClone.NumTurnsRemaining, false); } else { // Update clone's per tick value to consider the caster's spell/melee buffs/debuffs bool isCrit; int perTickAmountWithStatMods = getAbilityAmountWithStatMods( combatantModel, abilityDurationDataClone.PerTickAmount, combatAbility.IsSpellBased, out isCrit); abilityDurationDataClone.PerTickAmount = perTickAmountWithStatMods; abilityDurationDataClone.IsCrit = isCrit; AbilityDurationDataCollection abilityDurationCollection = isAbilityFriendly ? targets[t].RegenOverTimeAbilityDurations : targets[t].DamageOverTimeAbilityDurations; abilityDurationCollection.Add(abilityDurationDataClone); combatActionOnTarget = new CombatActionModel( combatantModel.ID, CombatActionType.AffectedByDurationAbility, combatAbility.ID, targets[t].ID, 0, abilityDurationDataClone.NumTurnsRemaining, isCrit); } } combatActionsCollection[targets[t].ID].Add(combatActionOnTarget); // If target has died then append death CombatActionModel if (!targets[t].IsAlive()) { combatActionsCollection[targets[t].ID].Add( new CombatActionModel(combatantModel.ID, CombatActionType.Death, combatAbility.ID, targets[t].ID, 0, 0, false)); } } }
/// <summary> /// Returns true if the specified flags are set. /// </summary> /// <param name="flags"></param> /// <returns></returns> public bool Is(CombatActionType flags) { return flags == this.Flags || (flags != CombatActionType.None && (this.Flags & flags) != 0); }
public CombatActionDetails(int value, CombatActionType type, Transform targetTransform) { Value = value; Type = type; TargetTransform = targetTransform; }
/// <summary> /// Returns true if the given type equals the combat action's type. /// </summary> /// <param name="type"></param> /// <returns></returns> public bool Is(CombatActionType type) { return (this.Type == type); }
/// <summary> /// Creates new target action. /// </summary> /// <param name="type"></param> /// <param name="creature"></param> /// <param name="attacker"></param> /// <param name="skillId"></param> public TargetAction(CombatActionType type, Creature creature, Creature attacker, SkillId skillId) { this.Flags = type; this.Creature = creature; this.Attacker = attacker; this.SkillId = skillId; this.AttackerSkillId = skillId; }
public void TriggerAction(CombatActionType actionType, CombatOperation action) { CombatActions[actionType].Action?.Invoke(action); }