public readonly int[][] walkIndices; // [RDLU][index] #endregion Fields #region Constructors public UnitType(string name="", double maxHealth=100.0, AttackType attackType=AttackType.Melee, double attackStrength=1.0, double attackRange=1.0, double attackSpeed = 1.0, double defense=0.0, MovementType movementType=MovementType.Walker, double movementSpeed=1.0, List<Action> actions=null, List<Spell> spells=null, double gatherRate = 10.0, double goldCost=10.0, double ironCost=0.0, double manaCrystalsCost=0.0, Texture2D[] idleTextures=null, Texture2D[] attackTextures=null, Texture2D[] moveTextures=null) { this.name = name; this.maxHealth = maxHealth; this.attackType = attackType; this.attackStrength = attackStrength; this.attackRange = attackRange; this.attackSpeed = attackSpeed; this.defense = defense; this.movementType = movementType; this.movementSpeed = movementSpeed; this.actions = actions ?? new List<Action>(); this.spells = spells ?? new List<Spell>(); this.gatherRate = gatherRate; this.goldCost = goldCost; this.ironCost = ironCost; this.manaCrystalsCost = manaCrystalsCost; this.idleTextures = idleTextures ?? new Texture2D[] { }; this.attackTextures = attackTextures ?? new Texture2D[] { }; this.moveTextures = moveTextures ?? new Texture2D[] { }; }
public IList<MagicData> this[AttackType element, byte level] { get { return table[ElementToInt(element), level]; } }
public void checkStateEndOfAction() { Combat.reset(); currentAttack = AttackType.Basic; getSelectedManager().disableSelect(); attackProj.enabled = false; changeUnit.enabled = false; if (GameObject.FindGameObjectsWithTag("Player0Squad").Length == 0) { nLogicView.RPC("gameOver", RPCMode.All, 2); return; } if (GameObject.FindGameObjectsWithTag("Player1Squad").Length == 0) { nLogicView.RPC("gameOver", RPCMode.All, 1); return; } if (getSelectedManager ().numActions == SquadManager.MAX_ACTIONS) { currentStage = TurnStage.None; } else if(getSelectedManager ().numActions == 0) { getSelectedManager().nView.RPC("activeSquadColor", RPCMode.All, false); nextTurn(); } else currentStage = TurnStage.InBetween; updateUI(); }
public void Restart() { this.atkType = AttackType.Idle; this.life = 500; this.cd = 0; this.fight = false; }
protected Blob(string name, int health, int damage, AttackType attackType) { this.Name = name; this.Health = health; this.Damage = damage; this.AttackType = attackType; }
public InvalidMacSpoofAttackIpv4Attack(Target t1, Target t2, AttackType attackType) : base(attackType) { invalidMac = PhysicalAddress.Parse("FA-BA-DA-FA-BA-DA".ToUpper()); this.t1 = t1; this.t2 = t2; }
public DHCPACKInjectionAttack(AttackType attackType, string gateway, string dns, string MAC) : base(attackType) { this.gateway = gateway; this.dns = dns; this.MAC = MAC; }
public virtual void TestPower(Type type, ActionType actionType, AttackType attackType, string range, DamageTypes damageTypes, string effect, EffectTypes effectTypes, PowerFrequency frequency, PowerSource powerSource, string trigger) { Power power; power = Character.GetPowers().Where(x => (x.GetType() == type)).First(); Assert.NotNull(power, "Power not found"); Assert.AreEqual(actionType, power.Action); Assert.AreEqual(attackType, power.AttackTypeAndRange.AttackType); Assert.AreEqual(range, power.AttackTypeAndRange.Range); Assert.AreEqual(damageTypes, power.DamageTypes); Assert.AreEqual(effect != null, power.HasEffect); if (effect != null) { Assert.AreEqual(effect, power.Effect); } Assert.AreEqual(effectTypes, power.EffectTypes); Assert.AreEqual(frequency, power.Frequency); Assert.AreEqual(powerSource, power.PowerSource); Assert.AreEqual(trigger != null, power.HasTrigger); if (trigger != null) { Assert.AreEqual(trigger, power.Trigger); } }
public Attack(string _key, AttackType _attackType, int _damage, int? _cooldown, int? _col_rect_x, int? _col_rect_y) : base(_key, _col_rect_x.GetValueOrDefault(), _col_rect_y.GetValueOrDefault()) { attackType = _attackType; damage = _damage; cooldown = _cooldown.GetValueOrDefault(); }
public static Targets determineTargets(float size,DietType Diet, AttackType Attack) { if(Attack == AttackType.Scavenging){ return Targets.Dead; } else if(size >= 35){ return Targets.Smaller; } else if(size <= 5){ return Targets.Larger; } else if(Attack == AttackType.Rushing){ return Targets.Larger; } else if(Random.value<0.2){ return Targets.Both; } else{ float sizeWeight = (20-size)/100; float largeChance = 0.5f+sizeWeight; if(largeChance < Random.value){ return Targets.Larger; } else{ return Targets.Smaller; } } }
public UnitType(ContentManager contentManager=null, string name = "", double maxHealth = 100.0, AttackType attackType = AttackType.Melee, double attackStrength = 1.0, double attackRange = 1.0, double attackSpeed = 1.0, double defense = 0.0, MovementType movementType = MovementType.Walker, double movementSpeed = 1.0, List<Action> actions = null, List<Spell> spells = null, double gatherRate = 10.0, double goldCost = 10.0, double ironCost = 0.0, double manaCrystalsCost = 0.0, string textureFilename="", int frameWidth=16, int frameHeight=16, int[][] idleIndices=null, int[][] walkIndices=null, int[][]attackIndices=null) { this.name = name; this.maxHealth = maxHealth; this.attackType = attackType; this.attackStrength = attackStrength; this.attackRange = attackRange; this.attackSpeed = attackSpeed; this.defense = defense; this.movementType = movementType; this.movementSpeed = movementSpeed; this.actions = actions ?? new List<Action>(); this.spells = spells ?? new List<Spell>(); this.gatherRate = gatherRate; this.goldCost = goldCost; this.ironCost = ironCost; this.manaCrystalsCost = manaCrystalsCost; this.textureFilename = textureFilename; this.frameWidth = frameWidth; this.frameHeight = frameHeight; this.idleIndices = idleIndices ?? new [] {new [] { 0 }, new [] { 0 }, new [] { 0 }, new [] { 0 } }; this.walkIndices = walkIndices ?? new [] { new[] { 0 }, new[] { 0 }, new[] { 0 }, new[] { 0 } }; this.attackIndices = attackIndices ?? new [] { new[] { 0 }, new[] { 0 }, new[] { 0 }, new[] { 0 } }; if (contentManager != null) texture = contentManager.Load<Texture2D>(textureFilename); }
public IGroup CreateGroup(string name, int health, int damage, WarEffects warEffect, AttackType attack) { IWarEffect groupWarEffect = this.WarEffectFactory.CreateWarEffect(warEffect); IAttack groupAttack = this.AttackFactory.CreateAttack(attack); IGroup group = new Group(name, health, damage, groupAttack, groupWarEffect); return group; }
//TODO: Effects List. e.g. Slow, Freeze, Stun, etc. public Attack(int damageAmount, float knockbackAmount, AttackType attackType, GameObject attacker, GameObject target) { damage = damageAmount; knockback = knockbackAmount; type = attackType; attackOrigin = attacker; attackTarget = target; }
public Attacks (string name, int id, int fireAmount, float speed, int manaCost, AttackType type){ attName = name; attID = id; amountFired = fireAmount; attSpeed = speed; manaUse = manaCost; attType = type; }
public void Attack(AttackType attackType) { combosManager.AddAttackToCurrentSequence(attackType); if (nextAttackAlreadyTriggered() || !combosManager.IsComboAvailableForCurrentSequence()) combosManager.CancelCombo(); else triggerAttack(combosManager.GetAnimationForCurrentCombo()); }
public MagicAction(IScope scope, ICost cost, int power, AttackType attackType, IScreenEffect screenEffect) { _scope = scope; _cost = cost; _power = power; _attackType = attackType; _screenEffect = screenEffect; }
public WallCrashAction(IScope scope, ICost cost, IScreenEffect screenEffect, int power, AttackType attackType) { _scope = scope; _cost = cost; _screenEffect = screenEffect; _power = power; _attackType = attackType; }
/// <summary> /// Initializes a member of the attack class. /// </summary> /// <param name="Amount">the number of times this attack can be used, set it to -1 for unlimited uses</param> /// <param name="SplashDamage">A list of a list of coordinates that are checked for ships, they are offsets for the center which is implied to have a coordinate of {0,0} and each coordinate is added to the coordinates that the player is aiming at</param> /// <param name="CenterIncluded">A list that determines if the center coordinate {0,0} is included in the attack</param> /// <param name="MyAttack">/This is the thing that will happen if one of the opponent's items is found by this attack</param> /// <param name="AttackName">The string representation of the attack</param> public Attack(int Amount, int[][][] SplashDamage, bool[] CenterIncluded, AttackType MyAttack, string AttackName) { this.Amount = Amount; this.SplashDamage = SplashDamage; this.CenterIncluded = CenterIncluded; this.MyAttack = MyAttack; this.AttackName = AttackName; }
public DelugeAction(IScope scope, ICost cost, IScreenEffect screenEffect, int power, AttackType attackType, Landform waterLandform) { _scope = scope; _cost = cost; _screenEffect = screenEffect; _brinkLandform = waterLandform; _power = power; _attackType = attackType; }
public static double GetSpecialHitPerc(AttackType Data, string specialName) { if (Data.Hits < 1) return 0; double specials = GetSpecialHitCount(Data, specialName); specials /= Data.Hits; return specials * 100.0; }
public DefaultAttack(int power, AttackType attr) { Debug.Assert(0 <= power && power <= 9999, "攻撃力(" + power + ")は0から9999の間で指定してください。"); Debug.Assert(AttackType.なし <= attr && attr <= AttackType.神聖, "攻撃(" + attr + ")は物理~神聖の間で指定してください。"); this.Power = power; this.Type = attr; }
public Blob(string name, int health, int attackDamage, BehaviorType behaviorType, AttackType attackType) { this.Name = name; this.AttackDamage = attackDamage; this.InitHealth(health); this.BehaviorType = behaviorType; this.AttackType = attackType; this.triggerCounter = 0; this.initialDamage = attackDamage; }
public static WeaponItem MultistrikeTypeAttackWithModifications(String id, String name, String description, String itemTypeDetailsId, Dictionary<EquipmentTarget, EquipableItemModification> modificationsByTarget, Int32 attackDamagePerAttack, DamageType damageType, AttackType attackType, Int32 numberOfAttacks) { return New(id, name, description, itemTypeDetailsId, modificationsByTarget, Enumerable.Range(0, numberOfAttacks).Select(x => { var attack = AttackModel.Single(attackDamagePerAttack, damageType, attackType); return WeaponAttackModel.ForWeaponItem(attack, itemTypeDetailsId); }).ToArray()); }
public AttackSettings(int destinationVillage, AttackType attackType, string troopName, string troopCount) { DestinationVillage = destinationVillage; AttackType = attackType; TroopName = troopName; TroopCount = troopCount; }
public ResistivityType this[AttackType attr] { get { return (ResistivityType)_resist[(int)attr - (int)AttackType.物理]; } set { _resist[(int)attr - (int)AttackType.物理] = (byte)value; } }
public void Initialize(AttackType type, AttackStats stats) { m_pAttackStats = Instantiate(stats) as AttackStats; m_pAttackStats.transform.parent = this.transform; m_pAttackStats.gameObject.layer = this.gameObject.layer; m_pAttackType = Instantiate(type) as AttackType; m_pAttackType.transform.parent = this.transform; m_pAttackType.gameObject.layer = this.gameObject.layer; m_pAttackType.Initialize(this); }
protected Attack() { currentActionInt = int.MaxValue; name = "Unnamed Attack"; cooldown = float.MaxValue; duration = float.MaxValue; attackType = AttackType.Damage; distance = AttackDistance.Melee; damageType = DamageType.Melee; minHit = 0f; maxHit = 0f; }
public void StartAOEAttack() { if (player.GetComponent<PlayerController> ().alive) { if (!attacking) { attacking = true; attackType = AttackType.AOEAttack; attackStartTime = Time.timeSinceLevelLoad; } } }
protected Attack(int currentActionInt, string attackName, float coolDown, float duration, AttackType attackType, AttackDistance attackDist, DamageType damageType, float minHit, float maxHit) { this.currentActionInt = currentActionInt; this.name = attackName; this.cooldown = coolDown; this.duration = duration; this.attackType = attackType; this.distance = attackDist; this.damageType = damageType; this.minHit = minHit; this.maxHit = maxHit; }
public TowerData(TowerType type, string name, AttackType attackType, float range, float frequency, float basePower, int cost) : base(name) { Type = type; AttackType = attackType; Range = range; AttackFrequency = frequency; BasePower = basePower; Cost = cost; }
public override void takeDamage(AttackType attackType, int damage) { base.takeDamage(attackType, damage); }
private void Start() { allowedToCombo = false; allowedToAttack = true; previousAttack = AttackType.NULL; }
public MatchMessageUnitAttacked(int unitId, string ownerId, int enemyId, int damage, AttackType attackType) { UnitId = unitId; OwnerId = ownerId; EnemyId = enemyId; Damage = damage; AttackType = attackType; }
public static LootStats LootStats(WorldObject wo, LootStats ls, bool logstats) { // Weapon Properties double missileDefMod = 0.00f; double magicDefMod = 0.00f; double wield = 0.00f; int value = 0; ls.TotalItems++; // Loop depending on how many items you are creating for (int i = 0; i < 1; i++) { var testItem = wo; if (testItem is null) { ls.NullCount++; continue; } string itemType = testItem.ItemType.ToString(); if (itemType == null) { ls.NullCount++; continue; } switch (testItem.ItemType) { case ItemType.None: break; case ItemType.MeleeWeapon: ls.MeleeWeaponCount++; string strikeType = "N"; if (testItem.WeaponMagicDefense != null) { magicDefMod = testItem.WeaponMagicDefense.Value; } if (testItem.Value != null) { value = testItem.Value.Value; } if (testItem.WeaponMissileDefense != null) { missileDefMod = testItem.WeaponMissileDefense.Value; } if (testItem.WieldDifficulty != null) { wield = testItem.WieldDifficulty.Value; } if (testItem.WeaponSkill == Skill.TwoHandedCombat) { if (logstats == true) { ls.MeleeWeapons += $"{testItem.WeaponSkill},{wield},{testItem.Damage.Value},{strikeType},{testItem.DamageVariance.Value},{testItem.WeaponDefense.Value},{magicDefMod},{missileDefMod},{value},{testItem.Name}\n"; } else { ls.MeleeWeapons += $" {testItem.WeaponSkill}\t {wield}\t {testItem.Damage.Value}\t\t {strikeType} \t\t {testItem.DamageVariance.Value}\t\t {testItem.WeaponDefense.Value}\t\t {magicDefMod}\t\t {missileDefMod}\t\t {value}\t {testItem.Name}\n"; } } else { AttackType attackType = testItem.W_AttackType; string at = attackType.ToString("F"); if (at.Contains("DoubleSlash") || at.Contains("DoubleThrust")) { strikeType = "2x"; } else if (at.Contains("TripleSlash") || at.Contains("TripleThrust")) { strikeType = "3x"; } if (logstats == true) { ls.MeleeWeapons += $"{testItem.WeaponSkill},{wield},{testItem.Damage.Value},{strikeType},{testItem.DamageVariance.Value},{testItem.WeaponDefense.Value},{magicDefMod},{missileDefMod},{value},{testItem.Name}\n"; } else { ls.MeleeWeapons += $" {testItem.WeaponSkill}\t\t {wield}\t {testItem.Damage.Value}\t\t {strikeType}\t\t {testItem.DamageVariance.Value}\t\t {testItem.WeaponDefense.Value}\t\t {magicDefMod}\t\t {missileDefMod}\t\t {value}\t {testItem.Name}\n"; } } break; case ItemType.Armor: ls.ArmorCount++; string equipmentSet = "None"; if (testItem.EquipmentSetId != null) { equipmentSet = Enum.GetName(typeof(EquipmentSet), testItem.EquipmentSetId); } if (logstats == true) { ls.Armor += $"{testItem.ArmorLevel},{equipmentSet},{testItem.Value.Value},{testItem.Name}\n"; } else { ls.Armor += $" {testItem.ArmorLevel}\t {equipmentSet}\t\t {testItem.Value.Value} \t {testItem.Name}\n"; } if (testItem.Name.Contains("Sheild")) { break; } if (testItem.ArmorLevel > ls.MaxAL) { ls.MaxAL = testItem.ArmorLevel.Value; ls.MaxALItem = testItem.Name; } if (testItem.ArmorLevel < ls.MinAL) { ls.MinAL = testItem.ArmorLevel.Value; ls.MinALItem = testItem.Name; } break; case ItemType.Clothing: ls.ClothingCount++; break; case ItemType.Jewelry: ls.JewelryCount++; break; case ItemType.Creature: break; case ItemType.Food: ls.Food++; break; case ItemType.Money: break; case ItemType.Misc: string spirit = "Spirit"; string potionA = "Philtre"; string potionB = "Elixir"; string potionC = "Tonic"; string potionD = "Brew"; string potionE = "Potion"; string potionF = "Draught"; string potionG = "Tincture"; string healingKits = "Kit"; string spellcompGlyph = "Glyph"; string spellcompInk = "Ink"; string spellcompQuill = "Quill"; if (testItem.Name.Contains(spirit)) { ls.Spirits++; } else if (testItem is PetDevice petDevice) { ls.PetsCount++; int totalRatings = 0; int damage = 0; int damageResist = 0; int crit = 0; int critDamage = 0; int critDamageResist = 0; int critResist = 0; int petLevel = 0; if (petDevice.UseRequiresSkillLevel == 570) { petLevel = 200; } else if (petDevice.UseRequiresSkillLevel == 530) { petLevel = 180; } else if (petDevice.UseRequiresSkillLevel == 475) { petLevel = 150; } else if (petDevice.UseRequiresSkillLevel == 430) { petLevel = 125; } else if (petDevice.UseRequiresSkillLevel == 400) { petLevel = 100; } else if (petDevice.UseRequiresSkillLevel == 370) { petLevel = 80; } else if (petDevice.UseRequiresSkillLevel == 310) { petLevel = 50; } if (petDevice.GearDamage != null) { totalRatings += petDevice.GearDamage.Value; damage = petDevice.GearDamage.Value; } if (petDevice.GearDamageResist != null) { totalRatings += petDevice.GearDamageResist.Value; damageResist = petDevice.GearDamageResist.Value; } if (petDevice.GearCrit != null) { totalRatings += petDevice.GearCrit.Value; crit = petDevice.GearCrit.Value; } if (petDevice.GearCritDamage != null) { totalRatings += petDevice.GearCritDamage.Value; critDamage = petDevice.GearCritDamage.Value; } if (petDevice.GearCritDamageResist != null) { totalRatings += petDevice.GearCritDamageResist.Value; critDamageResist = petDevice.GearCritDamageResist.Value; } if (petDevice.GearCritResist != null) { totalRatings += petDevice.GearCritResist.Value; critResist = petDevice.GearCritResist.Value; } if (logstats == true) { ls.Pets += $"{petLevel},{damage},{damageResist},{crit},{critDamage},{critDamageResist},{critResist},{totalRatings}\n"; } else { ls.Pets += $" {petLevel}\t {damage}\t {damageResist}\t {crit}\t {critDamage}\t {critDamageResist}\t {critResist}\t {totalRatings}\n"; } if (totalRatings > 99) { ls.PetRatingsOverHundred++; } else if (totalRatings > 89) { ls.PetRatingsOverNinety++; } else if (totalRatings > 79) { ls.PetRatingsOverEighty++; } else if (totalRatings > 69) { ls.PetRatingsOverSeventy++; } else if (totalRatings > 59) { ls.PetRatingsOverSixty++; } else if (totalRatings > 49) { ls.PetRatingsOverFifty++; } else if (totalRatings > 39) { ls.PetRatingsOverForty++; } else if (totalRatings > 29) { ls.PetRatingsOverThirty++; } else if (totalRatings > 19) { ls.PetRatingsOverTwenty++; } else if (totalRatings > 9) { ls.PetRatingsOverTen++; } else if (totalRatings > 0) { ls.PetRatingsEqualOne++; } else if (totalRatings < 1) { ls.PetRatingsEqualZero++; } } else if (testItem.Name.Contains(potionA) || testItem.Name.Contains(potionB) || testItem.Name.Contains(potionC) || testItem.Name.Contains(potionD) || testItem.Name.Contains(potionE) || testItem.Name.Contains(potionF) || testItem.Name.Contains(potionG)) { ls.Poitions++; } else if (testItem.Name.Contains(spellcompGlyph) || testItem.Name.Contains(spellcompInk) || testItem.Name.Contains(spellcompQuill)) { ls.LevelEightComp++; } else if (testItem.Name.Contains(healingKits)) { ls.HealingKit++; } else { Console.WriteLine($"ItemType.Misc Name={testItem.Name}"); ls.Misc++; } break; case ItemType.MissileWeapon: double eleBonus = 0.00f; double damageMod = 0.00f; string missileType = "Other"; if (testItem.AmmoType != null) { switch (testItem.AmmoType.Value) { case ACE.Entity.Enum.AmmoType.None: break; case ACE.Entity.Enum.AmmoType.Arrow: missileType = " Bow"; ls.MissileWeaponCount++; break; case ACE.Entity.Enum.AmmoType.Bolt: missileType = " X Bow"; ls.MissileWeaponCount++; break; case ACE.Entity.Enum.AmmoType.Atlatl: missileType = " Thrown"; ls.MissileWeaponCount++; break; case ACE.Entity.Enum.AmmoType.ArrowCrystal: break; case ACE.Entity.Enum.AmmoType.BoltCrystal: break; case ACE.Entity.Enum.AmmoType.AtlatlCrystal: break; case ACE.Entity.Enum.AmmoType.ArrowChorizite: break; case ACE.Entity.Enum.AmmoType.BoltChorizite: break; case ACE.Entity.Enum.AmmoType.AtlatlChorizite: break; default: break; } } if (testItem.WeaponMagicDefense != null) { magicDefMod = testItem.WeaponMagicDefense.Value; } if (testItem.Value != null) { value = testItem.Value.Value; } if (testItem.WeaponMissileDefense != null) { missileDefMod = testItem.WeaponMissileDefense.Value; } if (testItem.WieldDifficulty != null) { wield = testItem.WieldDifficulty.Value; } if (testItem.ElementalDamageBonus != null) { eleBonus = testItem.ElementalDamageBonus.Value; } if (testItem.DamageMod != null) { damageMod = testItem.DamageMod.Value; } if (missileType == "Other") { ls.DinnerWare++; } else { if (logstats == true) { ls.MissileWeapons += $"{missileType},{wield},{Math.Round(damageMod, 2)},{eleBonus},{testItem.WeaponDefense.Value},{magicDefMod},{missileDefMod},{value}\n"; } else { ls.MissileWeapons += $" {missileType}\t {wield}\t {Math.Round(damageMod, 2)}\t\t{eleBonus}\t\t {testItem.WeaponDefense.Value}\t\t {magicDefMod}\t\t {missileDefMod}\t\t {value}\n"; } } break; case ItemType.Container: break; case ItemType.Useless: Console.WriteLine($"ItemType.Useless Name={testItem.Name}"); break; case ItemType.Gem: string aetheriaColor = "None"; if (testItem.Name.Contains("Aetheria")) { ls.AetheriaCount++; if (testItem.WieldDifficulty == 75) { aetheriaColor = "Blue "; } else if (testItem.WieldDifficulty == 150) { aetheriaColor = "Yellow"; } else if (testItem.WieldDifficulty == 225) { aetheriaColor = "Red "; } if (logstats == true) { ls.Aetheria += $"{aetheriaColor},{testItem.ItemMaxLevel}\n"; } else { ls.Aetheria += $" {aetheriaColor}\t {testItem.ItemMaxLevel}\n"; } } else { ls.GemCount++; } break; case ItemType.SpellComponents: ls.SpellComponents++; break; case ItemType.Writable: string scrolls = "Scroll"; if (testItem.Name.Contains(scrolls)) { ls.Scrolls++; } else { Console.WriteLine($"ItemType.Writeable Name={testItem.Name}"); } break; case ItemType.Key: ls.Key++; break; case ItemType.Caster: ls.CasterCount++; double eleMod = 0.00f; if (testItem.WeaponMagicDefense != null) { magicDefMod = testItem.WeaponMagicDefense.Value; } if (testItem.Value != null) { value = testItem.Value.Value; } if (testItem.WeaponMissileDefense != null) { missileDefMod = testItem.WeaponMissileDefense.Value; } if (testItem.WieldDifficulty != null) { wield = testItem.WieldDifficulty.Value; } if (testItem.ElementalDamageMod != null) { eleMod = testItem.ElementalDamageMod.Value; } if (testItem.ItemMaxMana != null) { ls.ItemMaxMana = testItem.ItemMaxMana.Value; } if (logstats == true) { ls.CasterWeapons += $"{wield},{eleMod},{testItem.WeaponDefense.Value},{magicDefMod},{missileDefMod},{value},{ls.ItemMaxMana}\n"; } else { ls.CasterWeapons += $" {wield}\t {eleMod}\t\t {testItem.WeaponDefense.Value}\t\t {magicDefMod}\t\t {missileDefMod}\t\t {value}\t {ls.ItemMaxMana}\n"; } break; case ItemType.Portal: break; case ItemType.Lockable: break; case ItemType.PromissoryNote: break; case ItemType.ManaStone: ls.ManaStone++; break; case ItemType.Service: break; case ItemType.MagicWieldable: break; case ItemType.CraftCookingBase: ls.OtherCount++; break; case ItemType.CraftAlchemyBase: ls.OtherCount++; break; case ItemType.CraftFletchingBase: ls.OtherCount++; break; case ItemType.CraftAlchemyIntermediate: ls.OtherCount++; break; case ItemType.CraftFletchingIntermediate: ls.OtherCount++; break; case ItemType.LifeStone: break; case ItemType.TinkeringTool: ls.OtherCount++; break; case ItemType.TinkeringMaterial: ls.OtherCount++; break; case ItemType.Gameboard: break; case ItemType.PortalMagicTarget: break; case ItemType.LockableMagicTarget: break; case ItemType.Vestements: break; case ItemType.Weapon: break; case ItemType.WeaponOrCaster: break; case ItemType.Item: Console.WriteLine($"ItemType.item Name={testItem.Name}"); break; case ItemType.RedirectableItemEnchantmentTarget: break; case ItemType.ItemEnchantableTarget: break; case ItemType.VendorShopKeep: break; case ItemType.VendorGrocer: break; default: ls.OtherCount++; break; } switch (itemType) { case "Armor": break; case "MeleeWeapon": break; case "Caster": break; case "MissileWeapon": break; case "Jewelry": break; case "Gem": break; case "Clothing": break; default: break; } if (testItem.ItemMaxMana != null) { if (testItem.ItemMaxMana > ls.MaxMana) { ls.MaxMana = testItem.ItemMaxMana.Value; } if (testItem.ItemMaxMana < ls.MinMana) { ls.MinMana = testItem.ItemMaxMana.Value; } ls.HasManaCount++; ls.TotalMaxMana += testItem.ItemMaxMana.Value; } if (testItem == null) { Console.WriteLine("*Name is Null*"); continue; } else { } } return(ls); }
public AllyObject(IGridObject gridObject, AttackType attackType, Action <Vector3> showEffect) : base(gridObject) { _attackType = attackType; _showEffect = showEffect; }
private float AddGrillDamage(float damage, MetaDataNode data, Vector3Int cellPos, Vector3 bulletHitTarget, AttackType attackType) { data.Damage += GRILL_ARMOR.GetDamage(damage, attackType); //Make grills a little bit weaker (set to 60 hp): if (data.Damage >= MAX_GRILL_DAMAGE) { tileChangeManager.RemoveTile(cellPos, LayerType.Grills); tileChangeManager.UpdateTile(cellPos, TileType.WindowDamaged, "GrillDestroyed"); SoundManager.PlayNetworkedAtPos("GrillHit", bulletHitTarget, 1f); //Spawn rods: if (Random.value < 0.4f) { SpawnRods(bulletHitTarget); } return(data.ResetDamage() - MAX_GRILL_DAMAGE); } return(0); }
public Pickup_Melee(Vector2 position, Texture2D texture, Texture2D weaponTexture, float damage, float attackSpeed, AttackType attackType) : base(position, texture) { itemType = ItemType.Melee; this.damage = damage; this.weaponTexture = weaponTexture; this.attackSpeed = attackSpeed; this.attackType = attackType; }
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { AttackType attackType = (AttackType)value; writer.WriteValue(attackType.ToString()); }
public void OnHitForMonster(AttackType attackType) { if ((attackType == AttackType.ATTACK1 || attackType == AttackType.ATTACK2 || attackType == AttackType.ATTACK3) && ((int)redhat.CurrentAttackType & (int)attackType) != 0) { return; } if (redhat.CurrentState == RedHatState.DEAD) { return; } if (PlayerFSMManager.Instance.isNormal) { PlayerEffects.Instance.basicNormal.ItemSetActive(redhat.hitLocation, "Effect"); } if (!PlayerFSMManager.Instance.isNormal) { PlayerEffects.Instance.basicSpecial.ItemSetActive(redhat.hitLocation, "Effect"); } redhat.CurrentAttackType = attackType; int value = GameLib.TransformTypeToInt(attackType); PlayerStat playerStat = PlayerFSMManager.Instance.Stat; float damage = (playerStat.GetStr() * playerStat.dmgCoefficient[value] * 0.01f); StartCoroutine(display.DamageDisplaying(damage)); CharacterStat.ProcessDamage(playerStat, redhat.Stat, damage); if (MCSoundManager.SoundCall >= MCSoundManager.SoundSkill3Break) { var sound = GetComponentInParent <MonsterSound>().monsterSFX; sound.PlayMonsterSFX(this.gameObject, sound.attackSFX[value]); if (attackType == AttackType.SKILL3) { MCSoundManager.SoundCall = 0; } } //SetKnockBack(playerStat, value); Invoke("AttackSupport", 0.5f); redhat.RigidBody.velocity = Vector3.zero; redhat.RigidBody.velocity = -PlayerFSMManager.Instance.Anim.transform.forward * PlayerFSMManager.Instance.Stat.KnockBackPower; if (attackType == AttackType.ATTACK1) { StartCoroutine(Shake.instance.ShakeCamera(0.03f, 0.04f, 0.1f)); } if (attackType == AttackType.ATTACK2) { StartCoroutine(Shake.instance.ShakeCamera(0.03f, 0.04f, 0.1f)); } if (attackType == AttackType.ATTACK3) { StartCoroutine(Shake.instance.ShakeCamera(0.07f, 0.07f, 0.1f)); } if (attackType == AttackType.SKILL1) { StartCoroutine(Shake.instance.ShakeCamera(0.05f, 0.1f, 0.1f)); } if (attackType == AttackType.SKILL2) { StartCoroutine(Shake.instance.ShakeCamera(0.15f, 0.1f, 0.1f)); } if (redhat.Stat.Hp > 0) { if (redhat.CurrentState == RedHatState.HIT) { return; } if (redhat.isNotChangeState) { return; } redhat.SetState(RedHatState.HIT); } else { StopAllCoroutines(); redhat.SetDeadState(); } }
public virtual void attack(AttackType attackType, AnimationCallback callback) { animationCallback = callback; showPlayerAttacking(attackType); }
public void notifyOnAttack(Unit attacker, Unit attacked, AttackType attackType) { var oa = new OnAttack(attacker, attacked, attackType); _game.PacketHandlerManager.broadcastPacket(oa, Channel.CHL_S2C); }
public void showPlayerAttacking(AttackType attackType) { animationType = AnimationType.Attacking; sprite.changeSpriteSheet(PlayerSpriteSheet.Type.Attacking, Location.direction); }
public OnAttackResponse(IAttackableUnit attacker, IAttackableUnit attacked, AttackType attackType) { Attacker = attacker; Attacked = attacked; AttackType = attackType; }
// Constructor public Blob(string name, int health, int attackDamage, BehaviorType behaviorType, AttackType currentAttackType) { this.Name = name; this.Health = health; this.AttackDamage = attackDamage; this.CurrentBehaviorType = behaviorType; this.CurrentAttackType = currentAttackType; this.isBlobDead = false; this.isBehaviorActivated = false; this.initialHealth = health; this.initialAttackDamage = attackDamage; }
/// <summary> /// Damage Plating/Catwalk/Lattice /// </summary> /// <param name="dmgAmt"></param> /// <param name="data"></param> /// <param name="cellPos"></param> /// <param name="worldPos"></param> /// <param name="attackType"></param> private float AddPlatingDamage(float dmgAmt, MetaDataNode data, Vector3Int cellPos, Vector2 worldPos, AttackType attackType) { data.Damage += BASE_ARMOR.GetDamage(dmgAmt, attackType); if (data.Damage >= 30 && data.Damage < MAX_PLATING_DAMAGE) { TryScorch(cellPos); } else if (data.Damage >= MAX_PLATING_DAMAGE) { tileChangeManager.RemoveTile(cellPos, LayerType.Base); //Spawn remains: if (Random.value < 0.25f) { SpawnRods(worldPos); } else if (Random.value > 0.75f) { SpawnMetal(worldPos); } // SoundManager.PlayNetworkedAtPos("PlatingHit", worldPos, 1f); return(data.ResetDamage() - MAX_PLATING_DAMAGE); } return(0); }
/// <summary> /// set the attack type to none if an attack ends /// to allow for a new attack type to be chosen /// </summary> protected virtual void OnStop_Attack() { m_NextAttackType = AttackType.None; }
private float AddWindowDamage(float damage, MetaDataNode data, Vector3Int cellPos, Vector3 bulletHitTarget, AttackType attackType) { data.Damage += REINFORCED_WINDOW_ARMOR.GetDamage(damage, attackType); if (data.Damage >= 20 && data.Damage < 50 && data.WindowDmgType != "crack01") { tileChangeManager.UpdateTile(cellPos, TileType.WindowDamaged, "crack01"); data.WindowDmgType = "crack01"; } if (data.Damage >= 50 && data.Damage < 75 && data.WindowDmgType != "crack02") { tileChangeManager.UpdateTile(cellPos, TileType.WindowDamaged, "crack02"); data.WindowDmgType = "crack02"; } if (data.Damage >= 75 && data.Damage < MAX_WINDOW_DAMAGE && data.WindowDmgType != "crack03") { tileChangeManager.UpdateTile(cellPos, TileType.WindowDamaged, "crack03"); data.WindowDmgType = "crack03"; } if (data.Damage >= MAX_WINDOW_DAMAGE && data.WindowDmgType != "broken") { tileChangeManager.UpdateTile(cellPos, TileType.WindowDamaged, "none"); tileChangeManager.RemoveTile(cellPos, LayerType.Windows); //Spawn 3 glass shards with different sprites: SpawnGlassShards(bulletHitTarget); //Play the breaking window sfx: SoundManager.PlayNetworkedAtPos("GlassBreak0#", bulletHitTarget, 1f); data.WindowDmgType = "broken"; return(data.ResetDamage() - MAX_WINDOW_DAMAGE); } return(0); }
public void AddAttackType(AttackType attackType, int amountOfDamage) { AttackTypes[attackType] = amountOfDamage; }
private float DoCalculateDamage(Creature attacker, Creature defender, WorldObject damageSource) { var playerAttacker = attacker as Player; var playerDefender = defender as Player; Attacker = attacker; Defender = defender; CombatType = attacker.GetCombatType(); DamageSource = damageSource; Weapon = attacker.GetEquippedWeapon(); AttackType = attacker.GetAttackType(Weapon, CombatManeuver); AttackHeight = attacker.AttackHeight ?? AttackHeight.Medium; // check lifestone protection if (playerDefender != null && playerDefender.UnderLifestoneProtection) { LifestoneProtection = true; playerDefender.HandleLifestoneProtection(); return(0.0f); } if (defender.Invincible ?? false) { return(0.0f); } // evasion chance EvasionChance = GetEvadeChance(attacker, defender); if (EvasionChance > ThreadSafeRandom.Next(0.0f, 1.0f)) { Evaded = true; return(0.0f); } // get base damage if (playerAttacker != null) { GetBaseDamage(playerAttacker, CombatManeuver); } else { GetBaseDamage(attacker, CombatManeuver); } if (GeneralFailure) { return(0.0f); } // get damage modifiers PowerMod = attacker.GetPowerMod(Weapon); AttributeMod = attacker.GetAttributeMod(Weapon); SlayerMod = WorldObject.GetWeaponCreatureSlayerModifier(attacker, defender); // additive? ElementalDamageBonus = WorldObject.GetMissileElementalDamageModifier(attacker, defender, DamageType); // ratings DamageRatingBaseMod = Creature.GetPositiveRating(attacker.GetProperty(PropertyInt.DamageRating) ?? 0); RecklessnessMod = Creature.GetRecklessnessMod(attacker, defender); SneakAttackMod = attacker.GetSneakAttackMod(defender); HeritageMod = attacker.GetHeritageBonus(Weapon) ? 1.05f : 1.0f; DamageRatingMod = Creature.AdditiveCombine(DamageRatingBaseMod, RecklessnessMod, SneakAttackMod, HeritageMod, Creature.GetRatingMod(attacker.EnchantmentManager.GetDamageRating())); // damage before mitigation DamageBeforeMitigation = BaseDamage * AttributeMod * PowerMod * SlayerMod * DamageRatingMod + ElementalDamageBonus; // additives on the end? // critical hit? var attackSkill = attacker.GetCreatureSkill(attacker.GetCurrentWeaponSkill()); CriticalChance = WorldObject.GetWeaponCritChanceModifier(attacker, attackSkill); if (CriticalChance > ThreadSafeRandom.Next(0.0f, 1.0f)) { IsCritical = true; CriticalDamageMod = 1.0f + WorldObject.GetWeaponCritDamageMod(attacker, attackSkill); // recklessness excluded from crits RecklessnessMod = 1.0f; DamageRatingMod = Creature.AdditiveCombine(DamageRatingBaseMod, SneakAttackMod, HeritageMod, Creature.GetRatingMod(attacker.EnchantmentManager.GetDamageRating())); DamageBeforeMitigation = BaseDamageRange.Max * AttributeMod * PowerMod * SlayerMod * DamageRatingMod * CriticalDamageMod + ElementalDamageBonus; } // get armor rending mod here? var armorRendingMod = 1.0f; if (Weapon != null && Weapon.HasImbuedEffect(ImbuedEffectType.ArmorRending)) { armorRendingMod = WorldObject.GetArmorRendingMod(attackSkill); } // get body part / armor pieces / armor modifier if (playerDefender != null) { // select random body part @ current attack height GetBodyPart(AttackHeight); // get armor pieces Armor = attacker.GetArmorLayers(BodyPart); // this uses attacker.AttackTarget // get armor modifiers ArmorMod = attacker.GetArmorMod(DamageType, Armor, DamageSource, armorRendingMod); } else { // select random body part @ current attack height GetBodyPart(AttackHeight, defender); if (Evaded) { return(0.0f); } Armor = CreaturePart.GetArmorLayers((CombatBodyPart)BiotaPropertiesBodyPart.Key); // get target armor ArmorMod = CreaturePart.GetArmorMod(DamageType, Armor, DamageSource, armorRendingMod); } // get resistance modifiers WeaponResistanceMod = WorldObject.GetWeaponResistanceModifier(attacker, attackSkill, DamageType); if (playerDefender != null) { ResistanceMod = playerDefender.GetResistanceMod(DamageType, DamageSource, WeaponResistanceMod); } else { // todo: move out of creature part, not part-related? ResistanceMod = CreaturePart.GetResistanceMod(DamageType, DamageSource, WeaponResistanceMod); } // damage resistance rating DamageResistanceRatingMod = Creature.GetNegativeRatingMod(defender.EnchantmentManager.GetDamageResistRating()); // get shield modifier ShieldMod = defender.GetShieldMod(attacker, DamageType); // calculate final output damage Damage = DamageBeforeMitigation * ArmorMod * ShieldMod * ResistanceMod * DamageResistanceRatingMod; DamageMitigated = DamageBeforeMitigation - Damage; HandleLogging(playerAttacker, playerDefender); return(Damage); }
/// <summary> /// Calculates the raw damage, assuming this move has no additional effects. /// </summary> /// <param name="user">The Pokémon using this move.</param> /// <param name="defender">The Pokémon defending against this move.</param> /// <returns></returns> public int CalculateDamage(Pokémon user, Pokémon defender) { //Attacker's Level int A = user.Level; //Attacker's Attack or Special stat int B; //Attack's power int C = AttackPower; //Defender's Defense or Special stat int D; //STAB modifier (1.5 if this attack's type is one of the user's types; 1, otherwise). double X = user.Types.Contains(AttackType)?1.5:1; var temp = AttackType.AttackMultipliers(); var temp2 = temp[Type.Grass]; //Type effectiveness modifier. Product of the type effectiveness modifiers of this move's type against each of the defender's types. double Y = defender.Types.Aggregate ( seed: 1.0, //seed: r.NextDouble(), func: (result, item) => result * AttackType.AttackMultipliers()[item], resultSelector: result => result ); //TESTING //Manually put in the type effectiveness chart for our limited state space //(note, we use 'fire' to represent only charizard, including his 'flying' type, so 'fire' typing here may look inaccurate) //Same deal with gengar (ghost, poison) and bulbasaur (grass, poison) if ((defender.Types[0] == Type.Grass && (AttackType == Type.Ice || AttackType == Type.Fire)) || (defender.Types[0] == Type.Water && (AttackType == Type.Electric || AttackType == Type.Grass)) || (defender.Types[0] == Type.Fire && (AttackType == Type.Water || AttackType == Type.Electric || AttackType == Type.Ground)) || (defender.Types[0] == Type.Ghost && (AttackType == Type.Ground || AttackType == Type.Psychic))) { Y = 2.0; } else if ((defender.Types[0] == Type.Water && (AttackType == Type.Ice || AttackType == Type.Fire)) || (defender.Types[0] == Type.Grass && (AttackType == Type.Electric || AttackType == Type.Water || AttackType == Type.Ground)) || (defender.Types[0] == Type.Fire && AttackType == Type.Grass) || (defender.Types[0] == Type.Ghost && AttackType == Type.Grass)) { Y = 0.5; } else if (defender.Types[0] == Type.Ghost && AttackType == Type.Normal) { Y = 0.0; } else { Y = 1.0; } Console.WriteLine("Type effectiveness of " + AttackType + " against " + defender.Species.Name + ": " + Y); //Random number between 217 and 255 int Z = new Random().Next(217, 256); //int Z = r.Next(217, 256); switch (Category) { case MoveCategory.Physical: B = user.Stats[Stat.Attack]; D = defender.Stats[Stat.Defense]; break; case MoveCategory.Special: B = user.Stats[Stat.Special]; D = user.Stats[Stat.Special]; break; default: B = 0; D = int.MaxValue; break; } double damage = 2 * A / 5.0 + 2; damage *= B; damage *= C; damage /= D; damage = damage / 50 + 2; damage *= X; damage *= Y; damage *= Z; damage /= 255.0; /* * double damage2 = 2 * A / 5.0 + 2; * damage2 *= B; * damage2 *= C; * damage2 /= D; * damage2 = damage2 / 50 + 2; * damage2 *= X; * //damage2 *= Y; * damage2 *= Z; * damage2 /= 255.0; * * //Console.WriteLine("Damage with attack type multiplier: " + damage); * //Console.WriteLine("Damage without attack type multiplier: " + damage2); */ return((int)damage); }
public abstract void AcceptDamage(Combatant source, int delta, AttackType type = AttackType.None);
/// <returns>Damage in excess of the tile's current health, 0 if tile was not destroyed or health equaled /// damage done.</returns> private float DoDamageInternal(Vector3Int cellPos, float dmgAmt, Vector3 worldPos, AttackType attackType) { MetaDataNode data = metaDataLayer.Get(cellPos); //look up layer tile so we can calculate damage var layerTile = metaTileMap.GetTile(cellPos); if (layerTile is BasicTile basicTile) { //TODO: Incorporate more resistance, not just indestructible //determine damage resistance if (basicTile.Resistances.Indestructable) { return(0); } dmgAmt = basicTile.Armor.GetDamage(dmgAmt, attackType); } if (Layer.LayerType == LayerType.Walls) { if (metaTileMap.HasTile(cellPos, LayerType.Walls, true)) { // SoundManager.PlayNetworkedAtPos( "WallHit", worldPos, Random.Range( 0.9f, 1.1f ) ); return(AddWallDamage(dmgAmt, data, cellPos, worldPos, attackType)); } } if (Layer.LayerType == LayerType.Windows) { if (metaTileMap.HasTile(cellPos, LayerType.Windows, true)) { SoundManager.PlayNetworkedAtPos("GlassHit", worldPos, Random.Range(0.9f, 1.1f)); return(AddWindowDamage(dmgAmt, data, cellPos, worldPos, attackType)); } } if (Layer.LayerType == LayerType.Grills) { //Make sure a window is not protecting it first: if (!metaTileMap.HasTile(cellPos, LayerType.Windows, true)) { if (metaTileMap.HasTile(cellPos, LayerType.Grills, true)) { SoundManager.PlayNetworkedAtPos("GrillHit", worldPos, Random.Range(0.9f, 1.1f)); return(AddGrillDamage(dmgAmt, data, cellPos, worldPos, attackType)); } } } if (Layer.LayerType == LayerType.Objects) { if (metaTileMap.GetTile(cellPos, LayerType.Objects)?.TileType == TileType.Table) { // SoundManager.PlayNetworkedAtPos( "TableHit", worldPos, Random.Range( 0.9f, 1.1f ) ); return(AddTableDamage(dmgAmt, data, cellPos, worldPos, attackType)); } } if (Layer.LayerType == LayerType.Floors) { if (metaTileMap.HasTile(cellPos, LayerType.Floors, true)) { // SoundManager.PlayNetworkedAtPos( "FloorHit", worldPos, Random.Range( 0.9f, 1.1f ) ); return(AddFloorDamage(dmgAmt, data, cellPos, worldPos, attackType)); } } if (Layer.LayerType == LayerType.Base) { if (metaTileMap.HasTile(cellPos, LayerType.Base, true)) { // SoundManager.PlayNetworkedAtPos( "FloorHit", worldPos, Random.Range( 0.9f, 1.1f ) ); return(AddPlatingDamage(dmgAmt, data, cellPos, worldPos, attackType)); } } return(dmgAmt); }
public Damage(int totalDamage, AttackType type) { TotalDamage = totalDamage; this.attackType = type; }
private float AddTableDamage(float dmgAmt, MetaDataNode data, Vector3Int cellPos, Vector2 worldPos, AttackType attackType) { data.Damage += TABLE_ARMOR.GetDamage(dmgAmt, attackType); if (data.Damage >= MAX_TABLE_DAMAGE) { //watch out! must not accidentally destroy other objects like player! tileChangeManager.RemoveTile(cellPos, LayerType.Objects); // SoundManager.PlayNetworkedAtPos("TableHit", worldPos, 1f); //Spawn remains: if (Random.value < 0.25f) { SpawnRods(worldPos); } else if (Random.value > 0.75f) { SpawnMetal(worldPos); } return(data.ResetDamage() - MAX_TABLE_DAMAGE); } return(0); }
public override void Damage(float damage, float pushTime, Vector2 pushSpeed, BasicShipGameObject Damager, AttackType attackType) { if (attackType != Weakness && attackType != AttackType.Explosion && attackType != AttackType.Melee) { attackType = Resistence; } base.Damage(damage, pushTime, pushSpeed, Damager, attackType); }
private float AddWallDamage(float dmgAmt, MetaDataNode data, Vector3Int cellPos, Vector2 worldPos, AttackType attackType) { data.Damage += WALL_ARMOR.GetDamage(dmgAmt, attackType); if (data.Damage >= MAX_WALL_DAMAGE) { tileChangeManager.RemoveTile(cellPos, LayerType.Walls); // SoundManager.PlayNetworkedAtPos("WallHit", worldPos, 1f); //Spawn remains: if (Random.value < 0.05f) { SpawnRods(worldPos); } else if (Random.value > 0.95f) { SpawnMetal(worldPos); } return(data.ResetDamage() - MAX_WALL_DAMAGE); } return(0); }
/* * A function that makes a thrust attack */ public void Thrust(Stance playerStance) { // if we fit in the gap for a combo and there was a previous attack if (allowedToCombo && previousAttack != AttackType.NULL) { allowedToCombo = false; StopAllCoroutines(); if (previousAttack == AttackType.SLICE) { animController.CallAnimationChange(PlayerAnimationType.SLICE_THRUST_FROM_ANY_STANCE); switch (playerStance) { case Stance.TOP: triggerTimeIndex = DefineTriggerTime(PlayerAnimationType.SLICE_THRUST_FROM_ANY_STANCE, Stance.TOP); break; case Stance.MIDDLE: triggerTimeIndex = DefineTriggerTime(PlayerAnimationType.SLICE_THRUST_FROM_ANY_STANCE, Stance.MIDDLE); break; case Stance.BOTTOM: triggerTimeIndex = DefineTriggerTime(PlayerAnimationType.SLICE_THRUST_FROM_ANY_STANCE, Stance.BOTTOM); break; } } else if (previousAttack == AttackType.THRUST) { animController.CallAnimationChange(PlayerAnimationType.THRUST_THRUST_FROM_ANY_STANCE); switch (playerStance) { case Stance.TOP: triggerTimeIndex = DefineTriggerTime(PlayerAnimationType.THRUST_THRUST_FROM_ANY_STANCE, Stance.TOP); break; case Stance.MIDDLE: triggerTimeIndex = DefineTriggerTime(PlayerAnimationType.THRUST_THRUST_FROM_ANY_STANCE, Stance.MIDDLE); break; case Stance.BOTTOM: triggerTimeIndex = DefineTriggerTime(PlayerAnimationType.THRUST_THRUST_FROM_ANY_STANCE, Stance.BOTTOM); break; } } } else { animController.CallAnimationChange(PlayerAnimationType.THRUST_FROM_ANY_STANCE); switch (playerStance) { case Stance.TOP: triggerTimeIndex = DefineTriggerTime(PlayerAnimationType.SLICE_FROM_ANY_STANCE, Stance.TOP); break; case Stance.MIDDLE: triggerTimeIndex = DefineTriggerTime(PlayerAnimationType.SLICE_FROM_ANY_STANCE, Stance.MIDDLE); break; case Stance.BOTTOM: triggerTimeIndex = DefineTriggerTime(PlayerAnimationType.SLICE_FROM_ANY_STANCE, Stance.BOTTOM); break; } } StartCoroutine(ActivateTriggerInTime(timeToActivateThrustTrigger[triggerTimeIndex], AttackType.THRUST)); previousAttack = AttackType.THRUST; allowedToAttack = false; }
private float AddFloorDamage(float dmgAmt, MetaDataNode data, Vector3Int cellPos, Vector2 worldPos, AttackType attackType) { data.Damage += FLOOR_ARMOR.GetDamage(dmgAmt, attackType); if (data.Damage >= 30 && data.Damage < 70) { TryScorch(cellPos); } else if (data.Damage >= MAX_FLOOR_DAMAGE) { var removed = tileChangeManager.RemoveTile(cellPos, LayerType.Floors); if (Random.value < 0.25f) { if (removed is BasicTile basicTile) { var toSpawn = basicTile.SpawnOnDeconstruct; Spawn.ServerPrefab(toSpawn, worldPos); } } // SoundManager.PlayNetworkedAtPos("FloorHit", worldPos, 1f); return(data.ResetDamage() - MAX_FLOOR_DAMAGE); } return(0); }
public void ChangeWeapon(Weapon weapon) { if (reboundProgress != null) { reboundProgress.gameObject.SetActive(false); } //무기가 없을때 들어옴(아무것도 없을때) if (weapon == null) { nowWeapon = null; //이미지 제거 if (animator != null) { animator.runtimeAnimatorController = null; } if (spriteRenderer != null) { spriteRenderer.sprite = null; } UpdateWeaponUI(); attackType = AttackType.near; return; } //무기가 있을때 else { SoundManager.Instance.PlaySoundEffect("changeWeapon"); nowWeapon = weapon; attackType = nowWeapon.AttackType; //if (animator == null) // animator=GetComponent<Animator>(); if (animator != null) { animator.runtimeAnimatorController = Resources.Load <RuntimeAnimatorController>(string.Format("Animators/Weapon/{0}", weapon.weapontype)); if (nowWeapon != null) { nowWeapon.Initialize(animator); SetScale(nowWeapon.weaponScale); SetPostion(nowWeapon.relativePosition); } if (animator != null && weapon.weapontype != WeaponType.Flamethrower) { animator.Play("Fire", 0, 0f); animator.speed = 0f; if (hasIdleAnimation()) { animator.speed = 1f; } } if (CanRotateWeapon() == false) { FlipWeapon(false); } } //바뀐 무기가 근접무기일경우 근접무기 세팅 if (nowWeapon.AttackType == AttackType.near) { if (slashObject != null) { slashObject.Initialize(nowWeapon.damage, nowWeapon.slashColor, nowWeapon.slashSize, nowWeapon.weapontype); } } //근접무기가 아니면 꺼줌 else { if (slashObject != null) { SlashObjectOnOff(false); } } //카드케이스 if (nowWeapon != null) { if (nowWeapon.weapontype == WeaponType.CardCase) { GamePlayerManager.Instance.player.CardCaseCardOnOff(true); } else { GamePlayerManager.Instance.player.CardCaseCardOnOff(false); } } else if (nowWeapon == null) { GamePlayerManager.Instance.player.CardCaseCardOnOff(false); } //마인드애로우 if (nowWeapon != null) { if (nowWeapon.weapontype == WeaponType.MindArrow) { //이미지 제거 if (animator != null) { animator.runtimeAnimatorController = null; } } } UpdateWeaponUI(); } }
//STEP 3. METHODS AND FUNCTIONS public int DoAttack(Enemy Enemy) { Console.ForegroundColor = ConsoleColor.Green; AttackType chosenAttack = ChooseAttack(); int damage = 0; //if their selection is 1 if (chosenAttack == AttackType.Sword) { //there are only 6 grenades in the bag int att1Count = 0; if (att1Count > 5) { Console.WriteLine(@" ________________________________________________________________________________________________________ | |"); Console.WriteLine(" You can't find any more grenades. While you were looking through your bag, the zombies attack."); Console.WriteLine(" |________________________________________________________________________________________________________|"); } else { //calculate their chance of hitting (70%) Random rng = new Random(); int playerHitChance = rng.Next(1, 101); //Attack 1 hits if (playerHitChance < 70) { //calculate the amount of damage(20 - 35 HP) to the dragon, display to player, subtract amount from dragon HP damage = rng.Next(20, 36); Enemy.HP -= damage; Console.WriteLine(@" ________________________________________________________________________________________________________ | |"); Console.WriteLine(" The grenade hits the middle of the horde, and causes " + damage + " damage to the zombies!"); Console.WriteLine(" |________________________________________________________________________________________________________|"); att1Count++; } //didn't hit else { //tell the player they missed. Console.WriteLine(@" ________________________________________________________________________________________________________ | |"); Console.WriteLine(" The grenade fizzled out. It was a dud!"); Console.WriteLine(" |________________________________________________________________________________________________________|"); att1Count++; } } } //else if their selection is 2 else if (chosenAttack == AttackType.Magic) { //calculate their chance of hitting (98%) Random rng = new Random(); int playerShotChance = rng.Next(1, 101); if (playerShotChance < 98) { int playerCriticalChance = rng.Next(1, 101); int att2Count = 0; if (playerCriticalChance < 15) { //critical hit, causes 65 damage int att2critDam = 65; Enemy.HP -= att2critDam; Console.WriteLine(@" ________________________________________________________________________________________________________ | |"); Console.WriteLine(" You blasted the zombies with your shotgun, and it was a CRITICAL HIT! Causing 65 damage to the horde!"); Console.WriteLine(" |________________________________________________________________________________________________________|"); att2Count++; } else { //they hit, calculate the amount of damage(10 - 15 HP) to the dragon, display to player, subtract the amount from dragon HP damage = rng.Next(10, 16); Enemy.HP -= damage; Console.WriteLine(@" ________________________________________________________________________________________________________ | |"); Console.WriteLine(" You blasted the zombies with your shotgun, and caused " + damage + " damage to the horde!"); Console.WriteLine(" |________________________________________________________________________________________________________|"); att2Count++; } } //didn't hit else { //tell the player they missed. Console.WriteLine(@" ___________________________________________________________________________________________________ | |"); Console.WriteLine(" The shotgun misfired!"); Console.WriteLine(" |___________________________________________________________________________________________________|"); } } //else if their selection is 3, else if (chosenAttack == AttackType.Heal) { int healCount = 0; if (healCount > 4) { Console.WriteLine(@" ________________________________________________________________________________________________________ | |"); Console.WriteLine(" You can't find any more syringes. While you were looking through your bag, the zombies attack."); Console.WriteLine(" |________________________________________________________________________________________________________|"); } else { //calculate the amount they've healed(10 - 20 HP), display to player, add the amount to player HP Random rng = new Random(); damage = rng.Next(10, 21); HP += damage; Console.WriteLine(@" ________________________________________________________________________________________________________ | |"); Console.WriteLine(" You plunge a syringe into your heart, and heal " + damage + " points."); Console.WriteLine(" |________________________________________________________________________________________________________|"); healCount++; } } // else if (9) // { // HP = HP - 200; // Console.WriteLine(@" ___________________________________________________________________________________________________________________________________________ //| |"); // Console.WriteLine(" You realize that you're Superman, and take out the entire zombie horde with your heat vision. Wait, why did you let that doctor die?"); // Console.WriteLine("|___________________________________________________________________________________________________________________________________________|"); // } else if (chosenAttack == AttackType.Null) { Console.WriteLine(@" ________________________________________________________________________________________________________ | |"); Console.WriteLine(" You froze. The zombies attack"); Console.WriteLine(" |________________________________________________________________________________________________________|"); } return(damage); Console.ForegroundColor = ConsoleColor.DarkGreen; }