private void RerollIf1Or2(AttackSituation sit) { // bool ranged = sit.Attacker.MainHand ().IsRanged (); // if (ranged) { // sit.ToHitGauge.Modify (new Modifier (2, "Archery Style")); // } }
void ApplyAttackBonusToWeaponAttackContestAndSetWeaponUsed(AttackSituation c, bool offhand) { if (c.action is AT.Battle.Cast) { var cast = c.action as AT.Battle.Cast; ApplySpellAbilityAttackAndProficiencyBonus(c.ToHitGauge, cast.Spell.classType); return; } GenericWeapon w; if (offhand) { w = character.OffHand() as GenericWeapon; } else { w = character.MainHand(); } c.SetWeaponUsed(w); ApplyAttackAbilityBonus(c.ToHitGauge, offhand); ApplyAttackProficiencyBonus(c.ToHitGauge, offhand); }
private void AddPlus2IfRanged(AttackSituation sit, bool offhand) { if (sit.WeaponUsed != null && sit.WeaponUsed.IsRanged()) { sit.ToHitGauge.Modify(new Modifier(2, "Archery Style")); } }
void ApplyDamageBonusToWeaponAttack(PhysicalDamage e, AttackSituation c, bool offhand) { //will apply damage bonus with 0 proficiency bonus (you never add proficiency to damage) if (c.Attacker.OffHand() != c.WeaponUsed) { ApplyAttackDamageBonus(e.Gauge); } }
private void ApplyDexterityToAC(AttackSituation sit) { int value = Sheet.AbilityScoreModifierValue(character.GaugeByName("dexterity")); GenericArmour armour = character.PaperDoll.Armour(); if (armour != null && value > armour.MaxDexterityACModifier) { value = armour.MaxDexterityACModifier; } sit.ArmorClassGauge.Modify(new Modifier(value, "Dexterity")); }
private void AddAbilityModifierIfOffhand(Effect.PhysicalDamage effect, AttackSituation sit, bool offhand) { if (sit.WeaponUsed == sit.Attacker.OffHand() && sit.action.IsBonus) { effect.Gauge.Modify( new Modifier(sit.Attacker.ModifierValueFromWeapon(sit.WeaponUsed), "Two-weapon fighting") ); // Debug.LogError ("Offhand. Adding my thing!"); } // bool ranged = sit.Attacker.MainHand ().IsRanged (); // if (ranged) { // sit.ToHitGauge.Modify (new Modifier (2, "Archery Style")); // } }
void AdvDisIndicator(AttackSituation sit) { if (sit.DisadvantageFlagged() && sit.AdvantageFlagged()) { } else if (sit.AdvantageFlagged()) { GameObject o = Instantiate(UIManager.instance.advantageIndicator); o.transform.SetParent(Avatar, false); o.transform.localPosition = Vector3.zero + advDisIndOffset; } else if (sit.DisadvantageFlagged()) { GameObject o = Instantiate(UIManager.instance.disadvantageIndicator); o.transform.SetParent(Avatar, false); o.transform.localPosition = Vector3.zero + advDisIndOffset; } }
private void Add1ToAcIfArmour(AttackSituation sit) { bool adding = false; if (sit.Defender.PaperDoll.Armour() != null) { adding = true; } else if (sit.Defender.OffHand() is GenericArmour) { adding = true; } if (adding) { // Debug.LogError ("defense!"); sit.ArmorClassGauge.Modify(new Modifier(1, "Defensive")); } }
private void Add2IfOneHandedNoOtherWeapons(Character.Effect.PhysicalDamage effect, AttackSituation sit, bool offhand) { if (sit.WeaponUsed == null) { // Debug.LogError("thing again"); } if (sit.WeaponUsed.Properties.Contains(WeaponProperty.HEAVY)) { return; } GenericWeapon mainhand = sit.Attacker.MainHand(); Equipment off_hand = sit.Attacker.OffHand(); // Debug.LogError ("hfosdoih attack ?"); if (mainhand == sit.WeaponUsed) { if (off_hand is GenericWeapon || mainhand.Subtype == EquipmentSubtype.SIMPLE_FIST) { return; } else { // Debug.LogError ("yes!"); effect.Gauge.Modify(new Modifier(2, "Dueling")); } } else { if (sit.Attacker.MainHand().Subtype == EquipmentSubtype.SIMPLE_FIST) //no other weapon is present. // Debug.LogError ("yes!"); { effect.Gauge.Modify(new Modifier(2, "Dueling")); } } }
public override void Perform() { CallOnBegan(); //TargetEnemyTile param = (TargetEnemyTile) parameters [0]; //IsOffhand opt = (IsOffhand) ActionOptions [0].OptVal; AT.Character.Effect.PhysicalDamage hit; AT.Character.Effect.PhysicalDamage crit; Actor target = TargetActor(); attackSituation = new AttackSituation(actor.CharSheet, target.CharSheet, this); ResultType result = attackSituation.GetResult(); resultingEffect = null; if (IsOffhand) { hit = actor.CharSheet.OffhandAttackDamageEffect(attackSituation); crit = actor.CharSheet.OffhandAttackCritDamageEffect(attackSituation); //IsOffhand = true; } else { hit = actor.CharSheet.MainHandAttackDamageEffect(attackSituation); crit = actor.CharSheet.MainHandAttackCritDamageEffect(attackSituation); } switch (result) { case ResultType.CRITICAL_HIT: resultingEffect = crit; break; case ResultType.HIT: resultingEffect = hit; break; case ResultType.MISS: // actor.OnMissedAttack (); break; case ResultType.CRITICAL_MISS: // actor.OnMissedAttack (); break; } // Debug.Log("Attack was made: " + attackSituation.VerboseToString()); if (actor.GetComponent <CharacterAttacker> () != null) { actor.GetComponent <CharacterAttacker> ().OnAttackAnimationEnded += WaitForAnimationFinish; } else { if (resultingEffect != null) { resultingEffect.ApplyTo(target.CharSheet, this); } else { //target.InstantiateMissText (); } CallOnFinished(); } }
public void FlagDisadvantageIfRangedAndNearEnemyOrOutNormRange(AttackSituation sit, bool offhand) { Battle.Attack attack = sit.action as Battle.Attack; TileMovement tmv; List <Battle.Actor> actorsInRange; if (attack == null) { // Debug.LogError ("hypoth"); //probably hypothetical Battle.Cast cast = sit.action as Battle.Cast; if (cast == null) { return; } if (cast.IsRangedSpell) { Battle.Actor caster = cast.actor; tmv = caster.TileMovement; actorsInRange = tmv.TilesWithinRange(1, true) .Select((t) => t.FirstOccupant) .Where((tm) => tm != null) .Select((tm) => tm.ActorComponent) .ToList(); if (actorsInRange.Select((a) => a.EnemiesWith(sit.action.actor)).Contains(true)) { sit.FlagDisadvantage(); // Debug.LogError ("dissing in range!"); } } return; } //Too near logic if (!attack.TypeChoice.IsRanged()) { return; } Battle.Actor attacker = attack.actor; tmv = attacker.TileMovement; actorsInRange = tmv.TilesWithinRange(1, true) .Select((t) => t.FirstOccupant) .Where((tm) => tm != null) .Select((tm) => tm.ActorComponent) .ToList(); // Debug.LogError ("Ctors: " + actorsInRange.Count); if (actorsInRange.Select((a) => a.EnemiesWith(sit.action.actor)).Contains(true)) { sit.FlagDisadvantage(); // Debug.LogError ("dissing in range!"); } if (attack.TargetActor().TileMovement.occupying.HCostTo(attack.actor.TileMovement.occupying) > sit.WeaponUsed.NormRng) { // Debug.LogError ("extended range. You sufer"); sit.FlagDisadvantage(); } }
private void ApplyBaseAC(AttackSituation sit) { sit.ArmorClassGauge.SetCurrent(character.ArmorClass); }
public CastRoutine SpellRangedAttack(SpellAttackEffector hit, MissileScript.MissileAnimationName missileName, SpellAttackEffector crit = null, SpellAttackEffector miss = null) { return((AT.Battle.Actor caster,AT.Battle.Action cast,List <AT.ATTile> targets) => { GameObject prefab = MissileAnimationPrefabDispenser.instance.GetAnimationPrefabByName(missileName); foreach (AT.ATTile target in targets) { AttackSituation sit = new AttackSituation(caster.CharSheet,target.FirstOccupant.CharSheet,cast); List <AT.Character.Effect.GenericEffect> resultingEffects = null; ResultType result = sit.GetResult(); switch (result) { case ResultType.HIT: resultingEffects = hit.Invoke(cast,target); break; case ResultType.CRITICAL_HIT: if (crit != null) { resultingEffects = crit.Invoke(cast,target); } break; case ResultType.MISS: if (miss != null) { resultingEffects = miss.Invoke(cast,target); } break; case ResultType.CRITICAL_MISS: //nothing break; } CharacterCastingAnimation castingAnims = caster.GetComponent <CharacterCastingAnimation>(); if (castingAnims != null) { castingAnims.SetupAndDoCastAnimation(cast); castingAnims.OneShotSpellRelease((animationInst) => { GameObject copy = Instantiate(prefab); copy.transform.position = caster.transform.position; MissileScript missile = copy.GetComponent <MissileScript>(); missile.LaunchAt(target,true); //Safe to not worry about unsubbing, thanks to garbage cleanup missile.OnConnectedWithTarget += (MissileScript self) => { if (resultingEffects != null) { foreach (AT.Character.Effect.GenericEffect effect in resultingEffects) { if (target.FirstOccupant != null) { effect.ApplyTo(target.FirstOccupant.CharSheet,cast); } } } //This assumes only one missile. Needs a "Checkin of sorts, to conditionally check on finished" cast.CallOnFinished(); }; }); //ToBe ATOCIJL } else { GameObject copy = Instantiate(prefab); copy.transform.position = caster.transform.position; MissileScript missile = copy.GetComponent <MissileScript>(); missile.LaunchAt(target.transform); //Safe to not worry about unsubbing, thanks to garbage cleanup missile.OnConnectedWithTarget += (MissileScript self) => { if (resultingEffects != null) { foreach (AT.Character.Effect.GenericEffect effect in resultingEffects) { effect.ApplyTo(target.FirstOccupant.CharSheet,cast); } } //This assumes only one missile. Needs a "Checkin of sorts, to conditionally check on finished" cast.CallOnFinished(); }; } } }); }
public CastRoutine SpellTouchAttack(SpellAttackEffector hit,SpellAttackEffector crit = null,SpellAttackEffector miss = null) { return((AT.Battle.Actor caster,AT.Battle.Action cast,List <AT.ATTile> targets) => { foreach (AT.ATTile target in targets) { AttackSituation sit = new AttackSituation(caster.CharSheet,target.FirstOccupant.CharSheet,cast); List <AT.Character.Effect.GenericEffect> resultingEffects = null; ResultType result = sit.GetResult(); switch (result) { case ResultType.HIT: resultingEffects = hit.Invoke(cast,target); break; case ResultType.CRITICAL_HIT: if (crit != null) { resultingEffects = crit.Invoke(cast,target); } break; case ResultType.MISS: if (miss != null) { resultingEffects = miss.Invoke(cast,target); } break; case ResultType.CRITICAL_MISS: //nothing break; } CharacterCastingAnimation castingAnims = caster.GetComponent <CharacterCastingAnimation>(); if (castingAnims != null) { castingAnims.SetupAndDoCastAnimation(cast); castingAnims.OneShotSpellRelease((animationInst) => { if (resultingEffects != null) { foreach (AT.Character.Effect.GenericEffect effect in resultingEffects) { if (target.FirstOccupant != null) { effect.ApplyTo(target.FirstOccupant.CharSheet,cast); } } } }); castingAnims.OneShotAnimEnded((animationInst) => { cast.CallOnFinished(); }); } else { if (resultingEffects != null) { foreach (AT.Character.Effect.GenericEffect effect in resultingEffects) { effect.ApplyTo(target.FirstOccupant.CharSheet,cast); } } cast.CallOnFinished(); } } }); }