public void Trigger(PartyMember partyMember, PartyBattleLayout partyBattleLayout) { int damage = partyMember.CalculateDamageTaken(this); if (damage > 0) { partyMember.DoDamage(damage, true, false); } if (partyMember.Alive) { partyMember.ApplyStatusEffectsFromAttributes(setter, Attributes, battle); } if (Attributes.Enhancement == Enhancement.Explosive) { ParticleEffect.AddExplosion(entity.GetCenter(), battle); List <PartyMember> partyMemberList = partyBattleLayout.GetListBehindTrap(this); if (partyMemberList != null && partyMemberList.Count > 0) { PartyMember frontPartyMember = partyMemberList[0]; damage = frontPartyMember.CalculateDamageTaken(this); frontPartyMember.DoDamage(damage, false); if (frontPartyMember.Alive) { frontPartyMember.ApplyStatusEffectsFromAttributes(setter, Attributes, battle); } } } else { ParticleEffect.AddSmokePuff(entity.GetCenter(), battle); } partyBattleLayout.RemoveTrap(this); Kill(); }
private void _doDamage(object[] args) { // doDamage(string actorPartyMemberSelector, string targetPartyMemberSelector) string actorPartyMemberSelector = (string)args[0]; string targetPartyMemberSelector = (string)args[1]; PartyMember actor = getPartyMemberFromSelector(actorPartyMemberSelector); PartyMember selectedTarget = getPartyMemberFromSelector(targetPartyMemberSelector); List <PartyMember> targets; if (actor.EquippedWeapon == null) { targets = new List <PartyMember>(1); targets.Add(selectedTarget); } else { targets = getTargetsFromEnhancement(selectedTarget, actor.EquippedWeapon.Attributes.Enhancement); if (actor.EquippedWeapon.Attributes.Enhancement == Enhancement.Explosive) { ParticleEffect.AddExplosion(selectedTarget.BattleEntity.GetCenter(), battle); } } int damage = -1; foreach (PartyMember target in targets) { bool breakNow = false; if (actor.EquippedWeapon.Attributes.Enhancement == Enhancement.Relentless) { if (damage < 0) { damage = target.CalculateDamageTaken(actor); } int damageDealt = Math.Min(damage, target.Health); target.DoDamage(damage, false); damage -= damageDealt; if (damage <= 0) { breakNow = true; } } else { damage = target.CalculateDamageTaken(actor); target.DoDamage(damage, false); } if (actor.EquippedWeapon != null && target.Alive) { target.ApplyStatusEffectsFromAttributes(actor, actor.EquippedWeapon.Attributes, battle); } if (target.EquippedShield != null) { if (actor.EquippedWeapon.Data.WeaponType == WeaponType.Melee) { if (target.EquippedShield.Attributes.Enhancement == Enhancement.Spiky) { actor.DoDamage(Math.Max(damage / 10, 1), true, false); } actor.ApplyStatusEffectsFromAttributes(target, target.EquippedShield.Attributes, battle); } if (target.EquippedShield.Data.Script != null) { addNestedScriptRunner(target.EquippedShield.Data.Script, 0.0f); } } if (breakNow) { break; } } if (actor.EquippedWeapon != null && actor.EquippedWeapon.Attributes.Handling == Handling.Uncomfortable) { actor.DoDamage(Math.Max(actor.CalculateDamageTaken(actor) / 10, 1), true); } }
public static ParticleEffect AddSmokePuff(Vector2 position, Battle battle) { if (battle == null) throw new Exception("Battle cannot be null"); ParticleEffect particleEffect = new ParticleEffect(position, Color.White, 20, ResourceManager.GetTextureData("particles/cloud_1"), 500.0f, 500.0f, 0.6f, 0.6f, true); Scene.AddEntity(particleEffect); battle.Camera.Shake(new Vector2(3.0f, 0.0f), 0.1f); return particleEffect; }
public void AddStatusEffect(StatusEffect statusEffect) { if (!HasStatusEffect(statusEffect)) { StatusEffects.Add(statusEffect); if (BattleEntity != null) { ParticleEffect particleEffect = new ParticleEffect(BattleEntity.GetCenter(), Color.White, 10, statusEffect.TextureData, 200.0f, 0.0f, 0.5f, 1.0f, false); particleEffect.DepthOverride = BattleEntity.Position.Y + 5.0f; Scene.AddEntity(particleEffect); } } }