Exemplo n.º 1
0
        public string Heal(string[] args)
        {
            string healerName   = args[0];
            string receiverName = args[1];

            Character healer   = CheckIfCharacterExist(healerName);
            Character receiver = CheckIfCharacterExist(receiverName);

            if (healer.GetType().Name != "Cleric")
            {
                throw new ArgumentException(string.Format(ExceptionMessages.HealerCanNotHealException, healerName));
            }

            Cleric realHealer = (Cleric)healer;

            realHealer.Heal(receiver);

            return($"{realHealer.Name} heals {receiver.Name} for {realHealer.AbilityPoints}! {receiver.Name} has {receiver.Health} health now!");
        }
Exemplo n.º 2
0
        private void SpecialSelection()
        {
            if (this.currentSelected.entityType == EntityType.UNIT && this.currentSelected.GetType() == typeof(Cleric))
            {
                Debug.Log("CLERIC HEAL SELECTED");
            }

            if (Input.GetMouseButtonUp(0))
            {
                if (this.CastRayToWorld(GlobalSettings.LayerValues.groundLayer))
                {
                    Cleric   unit      = this.currentSelected as Cleric;
                    UnitBase selection = this._hitInfo.transform.GetComponent <UnitBase>();
                    float    distance  = Vector3.Distance(selection.position, unit.position) - (unit.unitRadius - unit.radiusDrawer.width);

                    Debug.DrawLine(unit.position, selection.position, Color.blue, 20.0f);
                    Debug.Log("Selection Distance: " + distance);
                    Debug.Log("Unit Heal Radius: " + unit.healingRadius);
                    Debug.Log("Unit Radius: " + unit.unitRadius);

                    if (distance > unit.healingRadius)
                    {
                        Debug.Log("Out Of Unit Heal Radius");
                        return;
                    }
                    else
                    {
                        if (selection.IsEnemy(unit as IHasHealth))
                        {
                            Debug.Log("CAN NOT HEAL ENEMY");
                            return;
                        }
                        else
                        {
                            Debug.Log("Can Heal " + (selection != null ? selection.name : "doesn't exist"));
                            unit.Heal(selection as IHasHealth);
                            this.DebugText(unit, selection);
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
    public string Heal(string[] args)
    {
        string healerName          = args[0];
        string healingReceiverName = args[1];

        CheckExistence(healerName);
        CheckExistence(healingReceiverName);

        var healerCharacter = allCharacters.FirstOrDefault(c => c.Name == healerName);
        var healingReceiver = allCharacters.FirstOrDefault(c => c.Name == healingReceiverName);

        if (!(healerCharacter is Cleric))
        {
            throw new ArgumentException($"{healerName} cannot heal!");
        }

        Cleric healer = (Cleric)healerCharacter;

        healer.Heal(healingReceiver);

        return
            ($"{healer.Name} heals {healingReceiver.Name} for {healer.AbilityPoints}! {healingReceiver.Name} has {healingReceiver.Health} health now!");
    }
Exemplo n.º 4
0
        public string Heal(string[] args)
        {
            StringBuilder sb = new StringBuilder();

            string healerName          = args[0];
            string healingReceiverName = args[1];

            Character healer   = GetCharacter(healerName);
            Character receiver = GetCharacter(healingReceiverName);

            Cleric cleric = healer as Cleric;

            if (cleric == null)
            {
                throw new ArgumentException($"{healerName} cannot heal!");
            }

            cleric.Heal(receiver);

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

            return(sb.ToString().TrimEnd());
        }