コード例 #1
0
        public void Setup()
        {
            healer = new Healer();
            npc    = new Mock <INonPlayerCharacter>();
            room   = new Mock <IRoom>();
            pc     = new Mock <IPlayerCharacter>();
            random = new Mock <IRandom>();
            Mock <ISpell> spell = new Mock <ISpell>();
            Dictionary <string, ISpell> spellBook = new Dictionary <string, ISpell>();

            healer.CastPercent = 100;
            room.Setup(e => e.NonPlayerCharacters).Returns(new List <INonPlayerCharacter>()
            {
                npc.Object
            });
            room.Setup(e => e.PlayerCharacters).Returns(new List <IPlayerCharacter>()
            {
                pc.Object
            });
            random.Setup(e => e.PercentDiceRoll(100)).Returns(true);
            npc.Setup(e => e.Room).Returns(room.Object);
            npc.Setup(e => e.SpellBook).Returns(spellBook);
            pc.Setup(e => e.KeyWords).Returns(new List <string>()
            {
                "PC"
            });
            spell.Setup(e => e.SpellName).Returns("spell");
            spellBook.Add(spell.Object.SpellName, spell.Object);

            GlobalReference.GlobalValues.Random = random.Object;
        }
コード例 #2
0
        public string Heal(string[] args)
        {
            string    healerName          = args[0];
            string    healingReceiverName = args[1];
            Character healer   = characters.FirstOrDefault(ch => ch.Name == healerName);
            Character receiver = characters.FirstOrDefault(ch => ch.Name == healingReceiverName);

            if (healer == null)
            {
                throw new ArgumentException($"Character {healerName} not found!");
            }
            if (receiver == null)
            {
                throw new ArgumentException($"Character {healingReceiverName} not found!");
            }

            if (healer.GetType().Name != nameof(Priest))
            {
                throw new ArgumentException($"{healerName} cannot heal!");
            }

            IHealer castedHealer = (IHealer)healer;

            castedHealer.Heal(receiver);

            StringBuilder sb = new StringBuilder();

            sb.AppendLine($"{healer.Name} heals {receiver.Name} for {healer.AbilityPoints}! {receiver.Name} has {receiver.Health} health now!");

            return(sb.ToString().Trim());
        }
コード例 #3
0
        void IDoHeal.OnHeal(IHealer source, IHealable target, int amount)
        {
            var player = target as IPlayer;

            if (player.Seat == Ui.Seat)
            {
                StartCoroutine(Play());
            }
        }
コード例 #4
0
ファイル: Healer.cs プロジェクト: Karlinna/depths
 public virtual void GetHeal(int value, IHealer got)
 {
     if (Health + value > HealthMax)
     {
         Health = HealthMax;
     }
     else
     {
         Health += value;
     }
 }
コード例 #5
0
 public Commands(
     IMovement movement,
     IRoomActions roomActions,
     IDebug debug,
     ISkills skills,
     ISpells spells,
     IObject objects,
     IInventory inventory,
     Icommunication communication,
     IEquip equipment,
     IScore score,
     ICombat combat,
     ICache cache,
     ISocials socials,
     ICommandHandler commandHandler,
     ICore core,
     IMobFunctions mobFunctions,
     IHelp help,
     IMobScripts mobScripts,
     ICrafting crafting,
     ICooking cooking,
     IUtilSkills utilSkills,
     IPassiveSkills passiveSkills,
     IHealer healer
     )
 {
     _movement       = movement;
     _roomActions    = roomActions;
     _debug          = debug;
     _skills         = skills;
     _spells         = spells;
     _object         = objects;
     _inventory      = inventory;
     _communication  = communication;
     _equipment      = equipment;
     _score          = score;
     _combat         = combat;
     _cache          = cache;
     _socials        = socials;
     _commandHandler = commandHandler;
     _core           = core;
     _mobFunctions   = mobFunctions;
     _help           = help;
     _mobScripts     = mobScripts;
     _crafting       = crafting;
     _cooking        = cooking;
     _utilSkills     = utilSkills;
     _passiveSkills  = passiveSkills;
     _healer         = healer;
 }
コード例 #6
0
        public void Healer_Constructor()
        {
            healer = new Healer(10);

            Assert.AreEqual(10, healer.CastPercent);
        }
コード例 #7
0
 /// <summary>
 /// Accepts the healer.
 /// </summary>
 /// <param name="healer">The healer.</param>
 public abstract void AcceptHealer(IHealer healer);
コード例 #8
0
 public AutoHealer(IHealer healer)
 {
     _healer = healer;
 }
コード例 #9
0
 void GameEvents.IDoHeal.OnHeal(IHealer source, IHealable target, int amount)
 {
     Text.text = Localization.Instance.Get(LocalizationIds.Heal) + "+" + amount;
     StartCoroutine(Animate());
 }
コード例 #10
0
 void IDoHeal.OnHeal(IHealer source, IHealable target, int amount) => CheckHealth(target as IRuntimeCharacter);
コード例 #11
0
 int IHealable.TakeHeal(IHealer source, int amount) => Health.TakeHeal(source, amount);
コード例 #12
0
 void OnDoneHeal(IHealer source, IHealable target, int amount) =>
 GameEvents.Instance.Notify <IDoHeal>(i => i.OnHeal(source, target, amount));
コード例 #13
0
 public override void GetHeal(int value, IHealer got)
 {
     HealThis(value);
 }
コード例 #14
0
 void GameEvents.IDoHeal.OnHeal(IHealer source, IHealable target, int amount) => TryApplyHeal(target, amount);
コード例 #15
0
        //-------------------------------------------------------------------

        public int TakeHeal(IHealer source, int amount) => IgnoreOverHeal(amount);
コード例 #16
0
 /// <summary>
 /// Accepts the healer.
 /// </summary>
 /// <param name="healer">The healer.</param>
 public override void AcceptHealer(IHealer healer) => healer.Heal(this);
コード例 #17
0
 public int TakeHeal(IHealer source, int amount) => Health.TakeHeal(source, amount);