all repos — RPG @ 5ec8a78dde387284a445b93ea73f4a6a14b5e1e6

Fully functional 3D turn based role playing game coded in C# and base Unity.

Assets/Scripts/Battle/Abilities/Defend.cs (view raw)

 1using System.Collections;
 2using System.Collections.Generic;
 3using UnityEngine;
 4
 5[System.Serializable]
 6public class Defend : Ability
 7{
 8
 9    //constructor
10    public Defend()
11    {
12        dbName = "Defend";
13        guiName = "Defend";
14        hasTarget = false;
15        ow_usable = false;
16        MP_cost = 0;
17    }
18
19    public override string Execute(Fighter source, Fighter target, out bool output)
20    {
21        source.defending = true;
22        source.stats.DEF *= 2;
23
24        output = true;
25        return source + " is defending!";
26    }
27
28    public override string GetDescription()
29    {
30        return "Double your defence for one turn.";
31    }
32}