Exemple #1
0
    public void ShowSupportTiles(MapTile startTile, SupportSkill support, Faction faction, bool isDanger)
    {
        if (isDanger)
        {
            return;
        }

        for (int i = 0; i < tiles.Length; i++)
        {
            int tempDist = DistanceTo(startTile, tiles[i]);
            if (!support.InRange(tempDist))
            {
                continue;
            }

            if (tiles[i].currentCharacter == null)
            {
                tiles[i].supportable = true;
            }
            else if (tiles[i].currentCharacter.faction == faction)
            {
                if (support.supportType == SupportType.BUFF || (support.supportType == SupportType.HEAL && tiles[i].currentCharacter.IsInjured()))
                {
                    tiles[i].supportable = true;
                }
            }
        }
    }
Exemple #2
0
    // private void Update()
    // {
    //     if (currentTime == thinkTime)
    //         Attack();

    //     currentTime -= Time.deltaTime;
    // }

    private void Attack()
    {
        Critter mine  = Referee.Instance.AttackerCritter;
        Critter enemy = Referee.Instance.DefenderCritter;

        Skill[] moves = mine.MoveSet;
        int     ind   = rand.Next(moves.Length);

        Skill skill = moves[ind];

        string msg;

        if (skill is AttackSkill)
        {
            float damage = mine.AttackDamage(skill as AttackSkill, enemy);
            Referee.Instance.CritterPlayer.TakeDamage(damage);

            msg = $"Used {skill.Name} \nDamage {damage}";
        }
        else
        {
            SupportSkill supportSkill = skill as SupportSkill;
            supportSkill.Use(mine);

            msg = $"Selected {skill.Name} \n{mine.LastUpgraded}";
        }

        EndAction(msg);
    }
Exemple #3
0
    private void Support(SupportSkill supportSkill)
    {
        supportSkill.Use(Referee.Instance.AttackerCritter);

        string msg = $"Selected {supportSkill.Name} \n{Referee.Instance.AttackerCritter.LastUpgraded}";

        EndAction(msg);
    }
    private void ShowDisplay()
    {
        dropdownAttackSkill.gameObject.SetActive(true);
        dropdownSupportSkill.gameObject.SetActive(true);

        attackSkillList = new List <string>()
        {
            "None"
        };
        supportSkillList = new List <string>()
        {
            "None"
        };

        attackSkills  = new Dictionary <int, AttackSkill>();
        supportSkills = new Dictionary <int, SupportSkill>();

        int indexAttack  = 1;
        int indexSupport = 1;

        for (int i = 0; i < Referee.Instance.CritterPlayer.MoveSet.Length; i++)
        {
            if (Referee.Instance.CritterPlayer.MoveSet[i] is AttackSkill)
            {
                AttackSkill skill = Referee.Instance.CritterPlayer.MoveSet[i] as AttackSkill;
                attackSkillList.Add(skill.name);
                attackSkills.Add(indexAttack++, skill);
            }
            else
            {
                SupportSkill skill = Referee.Instance.CritterPlayer.MoveSet[i] as SupportSkill;
                supportSkillList.Add(skill.name);
                supportSkills.Add(indexSupport++, skill);
            }
        }

        dropdownAttackSkill.AddOptions(attackSkillList);
        if (attackSkillList.Count <= 1)
        {
            dropdownAttackSkill.gameObject.SetActive(false);
        }
        else
        {
            dropdownAttackSkill.Show();
        }

        dropdownSupportSkill.AddOptions(supportSkillList);
        if (supportSkillList.Count <= 1)
        {
            dropdownSupportSkill.gameObject.SetActive(false);
        }
        else
        {
            dropdownSupportSkill.Show();
        }
    }
Exemple #5
0
 // Start is called before the first frame update
 void Start()
 {
     hpText1.text  = critter2.getHp().ToString() + " HP";
     hpText2.text  = critter1.getHp().ToString() + " HP";
     attackSkill   = new AttackSkill("Hit", 10, 2);
     attackSkill2  = new AttackSkill("Smash", 8, 0);
     attackSkill3  = new AttackSkill("Special", 8, 0);
     supportSkill1 = new SupportSkill("AtkUp");
     supportSkill2 = new SupportSkill("DefenseUp");
     supportSkill3 = new SupportSkill("SpdDwn");
 }
Exemple #6
0
 public bool CheckRange(TacticsMove player, bool isAttack)
 {
     if (isAttack)
     {
         WeaponSkill weapon = player.GetWeapon();
         if (weapon == null)
         {
             return(false);
         }
         for (int i = 0; i < enemyList.values.Count; i++)
         {
             int distance = MapCreator.DistanceTo(player, enemyList.values[i]);
             if (weapon.InRange(distance))
             {
                 return(true);
             }
         }
     }
     else
     {
         SupportSkill support = player.GetSupport();
         if (support == null)
         {
             return(false);
         }
         for (int i = 0; i < playerList.values.Count; i++)
         {
             if (!playerList.values[i].IsInjured())
             {
                 continue;
             }
             int distance = MapCreator.DistanceTo(player, playerList.values[i]);
             if (support.InRange(distance))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Exemple #7
0
    public bool CanSupport()
    {
        SupportSkill support = GetSupport();

        if (support == null)
        {
            return(false);
        }
        for (int i = 0; i < playerList.values.Count; i++)
        {
            bool usable = (playerList.values[i].IsInjured() || GetSupport().supportType == SupportType.BUFF);
            if (playerList.values[i] == this || !usable)
            {
                continue;
            }
            int distance = MapCreator.DistanceTo(this, playerList.values[i]);
            if (support.InRange(distance))
            {
                return(true);
            }
        }
        return(false);
    }
Exemple #8
0
    public static PlayerSkill GetPlayerSkill(int id, Player player)
    {
        PlayerSkill skill = null;

        switch ((OccupationType)player.occupation)
        {
        case OccupationType.Warrior: skill = new WarriorSkill(id, player);
            break;

        case OccupationType.Support: skill = new SupportSkill(id, player);
            break;

        case OccupationType.Mage: skill = new MageSkill(id, player);
            break;

        case OccupationType.Assassin: skill = new AssassinSkill(id, player);
            break;

        default:
            break;
        }

        return(skill);
    }
    public bool CheckTile(MapTile checkTile, int currentDistance, int moveSpeed, Faction faction, ClassType classType, WeaponSkill weapon, SupportSkill support, bool showAttack, bool isDanger)
    {
        if (checkTile == null)
        {
            return(false);
        }

        if (checkTile.currentCharacter != null)
        {
            if (checkTile.currentCharacter.faction != faction)
            {
                return(false);
            }
        }

        if (checkTile.GetRoughness(classType) == -1)
        {
            return(false);
        }
        currentDistance += checkTile.GetRoughness(classType);
        if (currentDistance >= checkTile.distance)
        {
            return(false);
        }

        checkTile.distance = currentDistance;
        if (isDanger)
        {
            checkTile.reachable = true;
        }
        else if (currentDistance <= moveSpeed && checkTile.currentCharacter == null)
        {
            checkTile.selectable = (checkTile.currentCharacter == null);
        }

        if (weapon != null && showAttack)
        {
            mapCreator.ShowAttackTiles(checkTile, weapon, faction, isDanger);
        }

        if (support != null && showAttack)
        {
            mapCreator.ShowSupportTiles(checkTile, support, faction, isDanger);
        }

        checkTile.parent = this;
        return(true);
    }
Exemple #10
0
    public void PopulateSkillList()
    {
        ClearList();
        int            id    = 0;
        StatsContainer cont  = clickCharacter.value;
        CharacterStats stats = characters[clickCharacter.value.statsID];

        spText.text = cont.currentSp.ToString();

        //Weapons
        for (int i = 0; i < stats.weapons.Length; i++)
        {
            WeaponSkill weapon = stats.weapons[i];
            Transform   skill  = Instantiate(skillTemplate);
            skill.SetParent(skillListParent);

            SkillRepresentation rep = skill.GetComponent <SkillRepresentation>();
            rep.skillID           = id++;
            rep.type              = SkillRepType.WEAPON;
            rep.typeIcon.color    = Color.red;
            rep.skillName.text    = weapon.skillName;
            rep.description.text  = weapon.description;
            rep.cost              = weapon.cost;
            rep.costText.text     = (i <= cont.weaponLevel) ? "Unlocked" : "SP: " + weapon.cost;
            rep.costText.color    = (cont.currentSp < weapon.cost && i == cont.weaponLevel + 1) ? Color.red : Color.black;
            rep.buttonImage.color = (i <= cont.weaponLevel) ? new Color(0.4f, 0.8f, 0.4f) :
                                    (i == cont.weaponLevel + 1) ? Color.white : Color.gray;
            rep.clickButton.interactable = (i == cont.weaponLevel + 1 && cont.currentSp >= weapon.cost);
            buttonList.Add(rep);
            skill.gameObject.SetActive(true);
        }

        //Supports
        for (int i = 0; i < stats.supports.Length; i++)
        {
            SupportSkill support = stats.supports[i];
            Transform    skill   = Instantiate(skillTemplate);
            skill.SetParent(skillListParent);

            SkillRepresentation rep = skill.GetComponent <SkillRepresentation>();
            rep.skillID           = id++;
            rep.type              = SkillRepType.SUPPORT;
            rep.typeIcon.color    = Color.cyan;
            rep.skillName.text    = support.skillName;
            rep.description.text  = support.description;
            rep.cost              = support.cost;
            rep.costText.text     = (i <= cont.supportLevel) ? "Unlocked" : "SP: " + support.cost;
            rep.costText.color    = (cont.currentSp < support.cost && i == cont.supportLevel + 1) ? Color.red : Color.black;
            rep.buttonImage.color = (i <= cont.supportLevel) ? new Color(0.4f, 0.8f, 0.4f) :
                                    (i == cont.supportLevel + 1) ? Color.white : Color.gray;
            rep.clickButton.interactable = (i == cont.supportLevel + 1 && cont.currentSp >= support.cost);
            buttonList.Add(rep);
            skill.gameObject.SetActive(true);
        }

        //Skills
        for (int i = 0; i < stats.skills.Length; i++)
        {
            SkillSkill skill          = stats.skills[i];
            Transform  skillTransform = Instantiate(skillTemplate);
            skillTransform.SetParent(skillListParent);

            SkillRepresentation rep = skillTransform.GetComponent <SkillRepresentation>();
            rep.skillID           = id++;
            rep.type              = SkillRepType.SKILL;
            rep.typeIcon.color    = Color.magenta;
            rep.skillName.text    = skill.skillName;
            rep.description.text  = skill.description;
            rep.cost              = skill.cost;
            rep.costText.text     = (i <= cont.skillLevel) ? "Unlocked" : "SP: " + skill.cost;
            rep.costText.color    = (cont.currentSp < skill.cost && i == cont.skillLevel + 1) ? Color.red : Color.black;
            rep.buttonImage.color = (i <= cont.skillLevel) ? new Color(0.4f, 0.8f, 0.4f) :
                                    (i == cont.skillLevel + 1) ? Color.white : Color.gray;
            rep.clickButton.interactable = (i == cont.skillLevel + 1 && cont.currentSp >= skill.cost);
            buttonList.Add(rep);
            skillTransform.gameObject.SetActive(true);
        }

        //Skill A
        for (int i = 0; i < stats.skillsA.Length; i++)
        {
            PassiveSkill passive        = stats.skillsA[i];
            Transform    skillTransform = Instantiate(skillTemplate);
            skillTransform.SetParent(skillListParent);

            SkillRepresentation rep = skillTransform.GetComponent <SkillRepresentation>();
            rep.skillID            = id++;
            rep.type               = SkillRepType.SKILLA;
            rep.typeIcon.color     = new Color(1f, 0.5f, 0);
            rep.typeCharacter.text = "A";
            rep.skillName.text     = passive.baseSkill.skillName;
            rep.description.text   = passive.baseSkill.description;
            rep.cost               = passive.baseSkill.cost;
            rep.costText.text      = (i <= cont.skillALevel) ? "Unlocked" : "SP: " + passive.baseSkill.cost;
            rep.costText.color     = (cont.currentSp < passive.baseSkill.cost && i == cont.skillALevel + 1) ? Color.red : Color.black;
            rep.buttonImage.color  = (i <= cont.skillALevel) ? new Color(0.4f, 0.8f, 0.4f) :
                                     (i == cont.skillALevel + 1) ? Color.white : Color.gray;
            rep.clickButton.interactable = (i == cont.skillALevel + 1 && cont.currentSp >= passive.baseSkill.cost);
            buttonList.Add(rep);
            skillTransform.gameObject.SetActive(true);
        }

        //Skill B
        for (int i = 0; i < stats.skillsB.Length; i++)
        {
            PassiveSkill passive        = stats.skillsB[i];
            Transform    skillTransform = Instantiate(skillTemplate);
            skillTransform.SetParent(skillListParent);

            SkillRepresentation rep = skillTransform.GetComponent <SkillRepresentation>();
            rep.skillID            = id++;
            rep.type               = SkillRepType.SKILLB;
            rep.typeIcon.color     = new Color(1f, 0.5f, 0);
            rep.typeCharacter.text = "B";
            rep.skillName.text     = passive.baseSkill.skillName;
            rep.description.text   = passive.baseSkill.description;
            rep.cost               = passive.baseSkill.cost;
            rep.costText.text      = (i <= cont.skillBLevel) ? "Unlocked" : "SP: " + passive.baseSkill.cost;
            rep.costText.color     = (cont.currentSp < passive.baseSkill.cost && i == cont.skillBLevel + 1) ? Color.red : Color.black;
            rep.buttonImage.color  = (i <= cont.skillBLevel) ? new Color(0.4f, 0.8f, 0.4f) :
                                     (i == cont.skillBLevel + 1) ? Color.white : Color.gray;
            rep.clickButton.interactable = (i == cont.skillBLevel + 1 && cont.currentSp >= passive.baseSkill.cost);
            buttonList.Add(rep);
            skillTransform.gameObject.SetActive(true);
        }

        //Skill C
        for (int i = 0; i < stats.skillsC.Length; i++)
        {
            PassiveSkill passive        = stats.skillsC[i];
            Transform    skillTransform = Instantiate(skillTemplate);
            skillTransform.SetParent(skillListParent);

            SkillRepresentation rep = skillTransform.GetComponent <SkillRepresentation>();
            rep.skillID            = id++;
            rep.type               = SkillRepType.SKILLC;
            rep.typeIcon.color     = new Color(1f, 0.5f, 0);
            rep.typeCharacter.text = "C";
            rep.skillName.text     = passive.baseSkill.skillName;
            rep.description.text   = passive.baseSkill.description;
            rep.cost               = passive.baseSkill.cost;
            rep.costText.text      = (i <= cont.skillCLevel) ? "Unlocked" : "SP: " + passive.baseSkill.cost;
            rep.costText.color     = (cont.currentSp < passive.baseSkill.cost && i == cont.skillCLevel + 1) ? Color.red : Color.black;
            rep.buttonImage.color  = (i <= cont.skillCLevel) ? new Color(0.4f, 0.8f, 0.4f) :
                                     (i == cont.skillCLevel + 1) ? Color.white : Color.gray;
            rep.clickButton.interactable = (i == cont.skillCLevel + 1 && cont.currentSp >= passive.baseSkill.cost);
            buttonList.Add(rep);
            skillTransform.gameObject.SetActive(true);
        }

        Debug.Log("Finished populating");
    }