/// <summary> /// Method to set a player's ability to a certain level. /// </summary> /// <param name="ability">Ability to be changed</param> /// <param name="level">New level</param> public void SetAbility(AbilityName ability, int level) { switch (ability) { case AbilityName.Immunity: Immunity = new Immunity(level); break; case AbilityName.TreatsGalore: TreatsGalore = new TreatsGalore(level); break; case AbilityName.Fearless: Fearless = new Fearless(level); break; case AbilityName.FatMouse: FatMouse = new FatMouse(level); break; case AbilityName.ScaryCat: ScaryCat = new ScaryCat(level); break; case AbilityName.BeastlyBuffet: BeastlyBuffet = new BeastlyBuffet(level); break; case AbilityName.Thief: Thief = new Thief(level); break; default: throw new ArgumentOutOfRangeException("ability", ability, "No such ability."); } }
void Awake() { animator = GetComponent <Animator>(); Health = GetComponent <PlayerHealth>(); BodyCollider = GetComponent <BoxCollider2D>(); mySpriteRenderer = GetComponent <SpriteRenderer>(); immunity = new Immunity(mySpriteRenderer); Health.CurrentValue = 3; }
public void Remove_NotExists_Tests() { var character = CreateMockCharacter(); var immunity = new Immunity("Test", "Description", 1); immunity.Remove(character); Assert.AreEqual(0, character.Immunities.Count); Assert.IsTrue(true); // If we made it here without exception no errors occured }
public void Remove_Exists_Tests() { var character = CreateMockCharacter(); var immunity = new Immunity("Test", "Description", 1); immunity.Apply(character); immunity.Remove(character); Assert.AreEqual(0, character.Immunities.Count); }
public void Apply_NotExisting_Test() { var character = CreateMockCharacter(); var immunity = new Immunity("Test", "Description", 1); immunity.Apply(character); Assert.AreEqual(1, character.Immunities.Count); Assert.AreSame(immunity, character.Immunities[0]); }
public Abilities(int immunityLevel, int treatsGaloreLevel, int fearlessLevel, int fatMouseLevel, int scaryCatLevel, int beastlyBuffetLevel, int thiefLevel) { Immunity = new Immunity(immunityLevel); TreatsGalore = new TreatsGalore(treatsGaloreLevel); Fearless = new Fearless(fearlessLevel); FatMouse = new FatMouse(fatMouseLevel); ScaryCat = new ScaryCat(scaryCatLevel); BeastlyBuffet = new BeastlyBuffet(beastlyBuffetLevel); Thief = new Thief(thiefLevel); }
public bool HaveImmunity(Immunity _immunity) { List <ImmunityNode> list = nodeList.GetImmunities; for (int i = 0; i < list.Count; i++) { if (list[i].GetImmunity == _immunity && list[i].GetEnable) { return(true); } } return(false); }
public int ComputeDamage(AttackType attackType, int damage) { if (Immunity.Contains(attackType)) { return(0); } else if (Weaknesses.Contains(attackType)) { return(damage * 2); } else { return(damage); } }
public void GetTested(VirusData virus) { if (!Alive) { return; } foreach (var genome in virus.Genomes) { if (!Immunity.Contains(genome.Genome)) { Alive = false; Console.WriteLine($"Pig {ID} is dead"); return; } } }
protected virtual void HandleImmunityCommand(CommandMatch cmd, IChannelMessageEventArgs message) { if (!EnsureOp(message)) { return; } var nickname = (string)cmd.Arguments[0]; string channel = ((Match)cmd.Arguments[1]).Value; if (channel == "GLOBAL") { channel = null; } using (DemoderationContext ctx = GetNewContext()) { Immunity immu = ctx.Immunities .FirstOrDefault(i => i.NicknameOrUsername.ToLowerInvariant() == nickname.ToLowerInvariant() && i.Channel == channel ); if (immu != null) { ConnectionManager.SendChannelMessage(message.Channel, $"{message.SenderNickname}: {nickname} already enjoys immunity."); return; } immu = new Immunity { NicknameOrUsername = nickname, Channel = channel }; ctx.Immunities.Add(immu); ctx.SaveChanges(); Logger.LogDebug( "{OpNickname} grants immunity {ID} to {ImmuneNickname} in {Channel}", message.SenderNickname, immu.ID, immu.NicknameOrUsername, immu.Channel ); } ConnectionManager.SendChannelMessage(message.Channel, $"{message.SenderNickname}: {nickname} is now immune."); }
public override void CalculateAttributeBonuses() { int levelBonus = 0; if (CurrentLevel > 90) { levelBonus = 1; } else if (CurrentLevel > 140) { levelBonus = 2; } ; int ptmBonus = GetPtmBonus(); int tacBonus = GetTacticsSkillBonus(); //will be 0 if not shown int tacImmBonus = GetTacticsSkillBonus(true); //will be 0 if not shown base.CalculateAttributeBonuses(); foreach (Attribute attribute in Attributes) { attribute.LevelBonus = levelBonus; } //these get tactics bonus so do separately Attack.SetAttributeBonus(Attributes, tacBonus); Parry.SetAttributeBonus(Attributes, tacBonus); Warcry.SetAttributeBonus(Attributes, tacBonus); Immunity.SetAttributeBonus(Attributes, tacImmBonus); foreach (Skill skill in Skills) { skill.LevelBonus = levelBonus; if (skill.Type != Skill.Types.Hitpoints && skill.Type != Skill.Types.Endurance && skill.Type != Skill.Types.Mana && skill.Type != Skill.Types.Profession) { skill.PtmBonus = ptmBonus; } } }
public void UpdatePanel(Creature c, CreatureList cList) { creature = c; // Make all conditions visible. for (int i = 0; i < allConditions.Length; i++) { allConditions[i].SetActive(true); } // Hide currently active conditions. for (int i = 0; i < creature.conditions.Count; i++) { switch (creature.conditions[i]) { case Creature.Conditions.Disarm: disarm.SetActive(false); break; case Creature.Conditions.Doomed: doomed.SetActive(false); break; case Creature.Conditions.Immobilize: immobilize.SetActive(false); break; case Creature.Conditions.Invisible: invisible.SetActive(false); break; case Creature.Conditions.Muddle: muddle.SetActive(false); break; case Creature.Conditions.Poison: poison.SetActive(false); break; case Creature.Conditions.Strengthen: strengthen.SetActive(false); break; case Creature.Conditions.Stun: stun.SetActive(false); break; case Creature.Conditions.Summon: summon.SetActive(false); break; case Creature.Conditions.Wound: wound.SetActive(false); break; } } // For boss, hide conditions that it is immune to. if (cList.stats.isBoss) { Immunity im = cList.stats.immunity; // Then Go through all immunities. disarm.SetActive(!im.disarm); doomed.SetActive(true); immobilize.SetActive(!im.immobilize); invisible.SetActive(true); muddle.SetActive(!im.muddle); poison.SetActive(!im.poison); strengthen.SetActive(true); stun.SetActive(!im.stun); summon.SetActive(false); wound.SetActive(!im.wound); } }
void Awake() { blink = GetComponent <Blink>(); heal = GetComponent <Heal>(); immunity = GetComponent <Immunity>(); }
public ImmunityNode(Immunity _immunity, NodeType _type, bool _unlocked = false, float _value = 1, int _levelrequirement = 0, int _maxLevel = 1, int _pointsPerLevel = 1, bool _ascended = false) : base(_type, _unlocked, _value, _levelrequirement, _maxLevel, _pointsPerLevel, _ascended) { immunity = _immunity; }
void Awake() { Immunity = new Immunity(Sprite); }