virtual protected void initialize()
    {
        stats = GetComponent <CharacterValues>();
        characterAnimation = GetComponent <AnimationSystem>();

        initialized = checkInitialization();
    }
    public void PlayMovementStartLoop(CharacterValues character)
    {
        moveAudio.loop = true;

        moveAudio.clip = character.walkSoundLoop;
        moveAudio.Play();
    }
    public void PlayDamageTaken(CharacterValues character)
    {
        spellAudio.loop = false;

        spellAudio.clip = character.takeDamageSound;
        spellAudio.Play();
    }
    void OnEnable()
    {
        t = (CharacterValues)target;
        t.Recalibrate();

        GetTarget = new SerializedObject(t);
        points    = GetTarget.FindProperty("points");
        values    = GetTarget.FindProperty("values");

        pointRandomMin = points.FindPropertyRelative("pointRandomMin");
        pointRandomMax = points.FindPropertyRelative("pointRandomMax");

        serializedPoints.Add(new SerializedPoint("vitality", "Vitality", points));
        serializedPoints.Add(new SerializedPoint("endurance", "Endurance", points));
        serializedPoints.Add(new SerializedPoint("strength", "Strength", points));
        serializedPoints.Add(new SerializedPoint("control", "Control", points));
        serializedPoints.Add(new SerializedPoint("resistance", "Resistance", points));
        serializedPoints.Add(new SerializedPoint("intelligence", "Intelligence", points));

        serializedValues.Add(new SerializedValue("health", "Health", values));
        serializedValues.Add(new SerializedValue("stamina", "Stamina", values));
        serializedValues.Add(new SerializedValue("painEndurance", "Pain Endurance", values));
        serializedValues.Add(new SerializedValue("staminaRecovery", "Stamina Recovery", values));
        serializedValues.Add(new SerializedValue("defensePhysical", "Physical Defense", values));
        serializedValues.Add(new SerializedValue("defensePlasma", "Plasma Defense", values));
        serializedValues.Add(new SerializedValue("defenseFire", "Fire Defense", values));
        serializedValues.Add(new SerializedValue("defenseIce", "Ice Defense", values));
        serializedValues.Add(new SerializedValue("defenseAuraColor", "Aura Color Defense", values));
        serializedValues.Add(new SerializedValue("defensePierce", "Pierce Resistance", values));
        serializedValues.Add(new SerializedValue("defenseLeech", "Leech Resistance", values));
        serializedValues.Add(new SerializedValue("defenseVirus", "Virus Resistance", values));
    }
Beispiel #5
0
 public void MoveArrow(CharacterValues character)
 {
     DisableArrows();
     //Arrow
     foreach (GameObject block in blocks)
     {
         if (block.GetComponent <BlockInfo>().character)
         {
             if (block.GetComponent <BlockInfo>().character == character)
             {
                 block.GetComponent <BlockInfo>().arrow.gameObject.SetActive(true);
             }
         }
     }
     //UITab
     foreach (GameObject tab in pBehaviour.charTabList)
     {
         if (tab.GetComponent <CharacterTab>().characterVal)
         {
             if (tab.GetComponent <CharacterTab>().characterVal == character)
             {
                 tab.GetComponent <CharacterTab>().highlight.gameObject.SetActive(true);
             }
         }
     }
 }
Beispiel #6
0
    private void HandleTurnChange(PlayerInfo player)
    {
        cv = player.thisCharacter;
        //Debug.Log("Handling event");
        spellButton1.GetComponent <Image>().sprite = cv.spell_1.spellIcon;
        spellButton2.GetComponent <Image>().sprite = cv.spell_2.spellIcon;
        spellButton3.GetComponent <Image>().sprite = cv.spell_3.spellIcon;
        spellButton4.GetComponent <Image>().sprite = cv.spell_4.spellIcon;
        spellButton5.GetComponent <Image>().sprite = cv.spell_5.spellIcon;
        spellButton6.GetComponent <Image>().sprite = cv.spell_6.spellIcon;

        spellButton1.GetComponent <Tooltip>().spell = cv.spell_1;
        spellButton2.GetComponent <Tooltip>().spell = cv.spell_2;
        spellButton3.GetComponent <Tooltip>().spell = cv.spell_3;
        spellButton4.GetComponent <Tooltip>().spell = cv.spell_4;
        spellButton5.GetComponent <Tooltip>().spell = cv.spell_5;
        spellButton6.GetComponent <Tooltip>().spell = cv.spell_6;

        HandleCooldownDecrease(cv.spell_1);
        HandleCooldownDecrease(cv.spell_2);
        HandleCooldownDecrease(cv.spell_3);
        HandleCooldownDecrease(cv.spell_4);
        HandleCooldownDecrease(cv.spell_5);
        HandleCooldownDecrease(cv.spell_6);

        playerBehaviour.UpdateTabs();
        UpdateHpApMp();
    }
        // Casting the spell
        public void CastSpell(SpellCreator spell, CharacterValues caster, Tile currentMouseTile)
        {
            playerBehaviour.aControll.PlayAttack(caster);
            playerBehaviour.aControll.PlaySpell(spell);
            Tile casterTile = gridController.GetTile(caster.currentTile.x, caster.currentTile.z);
            Tile targetTile = currentMouseTile;
            //Tile temp1 = gridController.GetTile(caster.currentTile.x,caster.currentTile.z);
            //Tile temp2 = gridController.GetTile(target.currentTile.x,target.currentTile.z);

            // V V V gets a list of tiles in AOE
            List <Tile> targetsList = spellHandler.AreaType(spell.areaType);

            // V V V goes through every attribute in the spells attribute list
            foreach (var temp in spell.spellArvot)
            {
                // V V V i need to make stuff here for attributes that dont need target and are single use
                if (temp.isSingleUse == true)
                {
                    TargetChecker(spell, temp, caster, currentMouseTile, currentMouseTile);
                }
                else
                {
                    foreach (var item in targetsList)
                    {
                        TargetChecker(spell, temp, caster, currentMouseTile, item);
                    }
                }
            }
            // V V V update UI and cooldowns
            spellCalculators.HandleCoolDownIncrease(spell);
            spellButtons.UpdateHpApMp();
        }
Beispiel #8
0
 // Game Objects are only used to make it easier to browse in the editor
 // TODO: Replace with a dedicated game object script class to handle these things?
 public void UpdateGameObjectInfo(CharacterValues c)
 {
     ID        = c.id;
     charName  = c.charName;
     maxHealth = c.health;
     level     = c.level;
     atk       = c.atk;
     def       = c.def;
 }
    public void CalculateEffects(CharacterValues effectTarget)
    {
        //Debug.Log("Starting effect calculation on " + effectTarget.name);
        if (effectTarget == null)
        {
            //Debug.Log("EffectTarget was null!");
            return;
        }
        List <EffectValues> effects = GetEffects(effectTarget);

        if (effects == null)
        {
            //Debug.Log("EffectList was null!");
            return;
        }
        ClearEffectValues(effectTarget);
        //Laita tähän efektien ikonien poistaminen, jos myöhemmin lisätään ikoni uudestaan (ei tällä hetkellä lisätä)
        if (effects.Count == 0)
        {
            //Debug.Log("No active effects");
            return;
        }
        List <string> effectNames = new List <string>();

        //Debug.Log("Starting effect calculation loop");
        foreach (EffectValues effect in effects)
        {
            if (effect != null && (effect.stacks || !effectNames.Contains(effect.name)))
            {
                //Debug.Log("Calculating " + effect.name);
                effectTarget.damagePlus    += effect.damageModifyPlus;
                effectTarget.damageChange  += effect.damageModifyPercent;
                effectTarget.armorPlus     += effect.armorModifyPlus;
                effectTarget.armorChange   += effect.armorModifyPercent;
                effectTarget.healsReceived += effect.healModify;
                effectTarget.currentAp     += effect.apModify;
                effectTarget.currentMp     += effect.mpModify;
                if (effect.immune == true)
                {
                    effectTarget.armorChange = 1000;
                }
                if (effect.heavyState == true)
                {
                    effectTarget.heavy = true;
                }
                if (!effectNames.Contains(effect.name))
                {
                    effectNames.Add(effect.name);
                }
                //pBehaviour.AddTabEffect(effect, effectTarget);
                //Debug.Log("Calculation done!");
            }
        }
    }
 public void AddTabEffect(EffectValues effect, CharacterValues target)
 {
     foreach (GameObject tab in charTabList)
     {
         CharacterTab tabby = tab.GetComponent <CharacterTab>();
         if (tabby.characterVal == target)
         {
             tabby.AddEffectIcon(effect);
         }
     }
 }
Beispiel #11
0
 public void CheckBlink(CharacterValues character)
 {
     if (!s1 && !s2 && !s3 && !s4 && !s5 && !s6 && (character.currentMp <= 0))
     {
         Blink();
     }
     else
     {
         StopBlinking();
     }
 }
Beispiel #12
0
    public void StealHp(CharacterValues target, int damage)
    {
        int heal = damage / 2;

        target.currentHP += heal;
        if (target.currentHP > target.currentMaxHP)
        {
            target.currentHP = target.currentMaxHP;
        }
        playerBehaviour.UpdateTabs();
        hitText.DamageText(target, heal);
    }
 public CharacterTab GetTab(CharacterValues character)
 {
     foreach (GameObject tab in charTabList)
     {
         CharacterTab tabby = tab.GetComponent <CharacterTab>();
         if (tabby.characterVal == character)
         {
             return(tabby);
         }
     }
     Debug.Log("No tab found");
     return(null);
 }
Beispiel #14
0
 public void RemoveBlock(CharacterValues character)
 {
     foreach (GameObject block in blocks)
     {
         if (block.GetComponent <BlockInfo>().character)
         {
             if (block.GetComponent <BlockInfo>().character == character)
             {
                 block.SetActive(false);
             }
         }
     }
 }
 public void ClearEffectValues(CharacterValues effectTarget)
 {
     //Tämä ei vaikuta kovin hyvältä tavalta hoitaa sittenkään...
     effectTarget.damagePlus    = 0;
     effectTarget.damageChange  = 0;
     effectTarget.armorPlus     = 0;
     effectTarget.armorChange   = 0;
     effectTarget.healsReceived = 0;
     //effectTarget.currentAp = effectTarget.maxAp;       //Hoida toisella tavalla nämä kaksi!
     //effectTarget.currentMp = effectTarget.maxMp;
     effectTarget.armorChange = 0;
     effectTarget.heavy       = false;
 }
 // V V V healing health values
 public void GetHealed(CharacterValues target, int heal)
 {
     target.currentHP += heal;
     //Popup
     if (target.currentHP != target.currentMaxHP && heal != 0)
     {
         hitText.DamageText(target, heal);
     }
     //Max hp check
     if (target.currentHP > target.currentMaxHP)
     {
         target.currentHP = target.currentMaxHP;
     }
 }
Beispiel #17
0
 public void GetDead(CharacterValues target)
 {
     target.dead = true; //  muista korjata startissa
     foreach (var temp in bodyList)
     {
         PlayerInfo      info         = temp.GetComponentInParent <PlayerInfo>();
         CharacterValues ego          = info.thisCharacter;
         PlayerMovement  kaikkiHajoaa = info.gameObject.GetComponent <PlayerMovement>();
         kaikkiHajoaa.CurrentTile = null;
         if (ego == target)
         {
             temp.SetActive(false);
         }
     }
 }
Beispiel #18
0
 //Deal the actual damage V V V
 public void GetHit(CharacterValues target, int damage)
 {
     //Damage dealt
     target.currentHP -= damage;
     //Popup
     if (damage != 0)
     {
         hitText.DamageText(target, damage * (-1));
     }
     //Max health reduction
     target.currentMaxHP -= Mathf.RoundToInt(damage * turnManager.maxHealthReduction);
     if (target.currentHP <= 0)
     {
         GetDead(target);
     }
     playerBehaviour.UpdateTabs();
 }
Beispiel #19
0
        public List <CharacterValues> TargetChecker(SpellCreator currentSpell)
        {
            List <Tile>            targetTileList = spellHandler.AreaType(currentSpell.areaType);
            List <CharacterValues> targetList     = new List <CharacterValues>();

            foreach (var item in targetTileList)
            {
                PlayerInfo      checker = item.CharCurrentlyOnTile;
                CharacterValues target  = null;
                if (checker)
                {
                    target = checker.thisCharacter;
                    targetList.Add(target);
                }
            }
            return(targetList);
        }
    //Calls all effects of a certain character
    public List <EffectValues> GetEffects(CharacterValues character)
    {
        List <EffectValues> tempList = new List <EffectValues>();

        foreach (EffectValues effect in effectList)
        {
            //if (effect.target.name == character.name)
            //{
            //    tempList.Add(effect);
            //}
            if (effect.target.team == character.team && effect.target.characterName == character.characterName)
            {
                tempList.Add(effect);
            }
        }
        return(tempList);    //Palauttaa ainoastaan ensimmäisellä vuorolla oikein?
    }
        public void TargetChecker(SpellCreator spell, SpellCreator.SpellAttribute spellAttribute, CharacterValues caster, Tile currentMouseTile, Tile item)
        {
            bool iNeedThis = spellChecker.CastNoTargetNeeded(spell, spellAttribute);
            // V V V checks if tile has a player
            PlayerInfo      checker = item.CharCurrentlyOnTile;
            CharacterValues target  = null;

            if (checker)
            {
                target = checker.thisCharacter;
            }

            // V V V cast the attribute if player is on tile
            if (target || iNeedThis == true)
            {
                CastAttribute(spellAttribute, caster, target, currentMouseTile);
            }
        }
Beispiel #22
0
//--------------------------------------------------------------------------METHODS:
    public void AddValues()
    {
        int i = 0;

        if (SceneManager.GetActiveScene().name != " Hotel Day 1")
        {
            characters = new GameObject[numOfCharacters];
            characters = GameObject.FindGameObjectsWithTag("Characters");
        }

        if (characters != null)
        {
            foreach (GameObject character in characters)
            {
                ShinningCharacters[i] = new CharacterValues(character.name, character.GetComponent <CharactersPattern>().InsanityValue);
                i++;
            }
        }
    }
Beispiel #23
0
        /// <summary>
        /// Will return the value of a normalized string based on the chosen method
        /// </summary>
        /// <param name="normalizedText">The normalized string</param>
        /// <param name="calculationMethod">The CalculationMethod to be used</param>
        /// <returns>The integer value of the string</returns>
        /// <exception cref="ArgumentException">Thrown when the CalculationMethod Enum parameter contains more than one value</exception>
        public static int GetValue(string normalizedText, CalculationMethod calculationMethod)
        {
            if ((calculationMethod & (calculationMethod - 1)) != 0)
            {
                throw new ArgumentException("CalculationMethod cannot have more than one flag when requesting a value.");
            }

            int value = 0;

            foreach (Char c in normalizedText)
            {
                if (CharacterValues.TryGetValue(c, out Dictionary <CalculationMethod, int> dic))
                {
                    value += dic[calculationMethod];
                }
            }

            return(value);
        }
        void savegameOverviewControl1_EntrySelectedEvent(object sender, EventArgs e)
        {
            SavegameOverviewEntry entry = (SavegameOverviewEntry)sender;
            UnitWrapper2          unit  = (UnitWrapper2)entry.Tag;

            this.Text = unit.Name;

            treeViewSkills.Nodes.Clear();
            CharacterSkills    skills    = unit.CharacterWrapper.CharacterSkills;
            CharacterValues    values    = unit.CharacterWrapper.CharacterValues;
            CharacterInventory inventory = unit.CharacterWrapper.CharacterInventory;

            AddCharacterStats(values);

            AddGeneralSkills(skills);

            AddCharacterSkills(skills);

            AddCharacterItems(inventory);
        }
    //Call this when you add another effect
    public void ApplyEffect(CharacterValues caster, EffectValues effect, CharacterValues target)
    {
        bool         inUse = false; //Tarvittiin sittenkin plaah
        EffectValues clone = Object.Instantiate(effect) as EffectValues;

        clone.caster         = caster;
        clone.target         = target;
        clone.remainingTurns = clone.effectDuration;
        //Debug.Log("Applying effect " + effect.effectName);

        foreach (EffectValues eff in effectList)
        {
            if (eff.target == clone.target)
            {
                if (eff.effectName == clone.effectName)
                {
                    inUse = true;
                    if (clone.stacks == false)
                    {
                        eff.remainingTurns = clone.effectDuration;      //New spells are always better!
                    }
                    else
                    {
                        effectList.Add(clone);
                        ////////////////pBehaviour.AddTabEffect(clone, target);
                    }
                }
                else
                {
                    effectList.Add(clone);
                    ////////////////////pBehaviour.AddTabEffect(clone, target);
                }
            }
        }
        if (!inUse)
        {
            effectList.Add(clone);
            //////////////////pBehaviour.AddTabEffect(clone, target);
        }
        CalculateEffects(target);
    }
        private void AddCharacterStats(CharacterValues values)
        {
            TreeNode characterValues = new TreeNode("Character stats");

            TreeNode accuracy = new TreeNode("Accuracy: " + values.Accuracy);

            accuracy.ForeColor = Color.Red;
            TreeNode strength = new TreeNode("Strength: " + values.Strength);

            strength.ForeColor = Color.Red;
            TreeNode stamina = new TreeNode("Stamina: " + values.Stamina);

            stamina.ForeColor = Color.Red;
            TreeNode willpower = new TreeNode("Willpower: " + values.Willpower);

            willpower.ForeColor = Color.Red;
            TreeNode availableAttributePoints = new TreeNode("Available attribute points: " + values.AttributePoints);

            availableAttributePoints.ForeColor = Color.Red;
            TreeNode availableSkillPoints = new TreeNode("Available skill points: " + values.SkillPoints);

            availableSkillPoints.ForeColor = Color.Red;
            TreeNode experiencePoints = new TreeNode("Experience points: " + values.Experience);

            experiencePoints.ForeColor = Color.Red;
            TreeNode achievementPoints = new TreeNode("Achievement points: " + values.AchievementPointsCur);

            achievementPoints.ForeColor = Color.Red;

            characterValues.Nodes.Add(accuracy);
            characterValues.Nodes.Add(strength);
            characterValues.Nodes.Add(stamina);
            characterValues.Nodes.Add(willpower);
            characterValues.Nodes.Add(availableAttributePoints);
            characterValues.Nodes.Add(availableSkillPoints);
            characterValues.Nodes.Add(experiencePoints);
            characterValues.Nodes.Add(achievementPoints);

            treeViewSkills.Nodes.Add(characterValues);
        }
Beispiel #27
0
    public void DamageText(CharacterValues target, int damage)
    {
        GameObject hit = hitTextPrefab;

        hit.transform.position = new Vector3(target.currentTile.x, 0, target.currentTile.z) + offset;

        hit.GetComponent <TextMesh>().text = "" + damage;
        if (damage < 0)
        {
            hit.GetComponent <TextMesh>().color = damageColor;
        }
        else if (damage > 0)
        {
            hit.GetComponent <TextMesh>().color = healColor;
        }
        else if (damage == 0)
        {
            hit.GetComponent <TextMesh>().color = zeroColor;
        }

        Instantiate(hit, hit.transform.position, hit.transform.rotation);
    }
Beispiel #28
0
 public void UpdateInfo(CharacterValues x)
 {
     character = x;
 }
Beispiel #29
0
 private void Awake()
 {
     cv = GetComponent<CharacterValues>();
 }
Beispiel #30
0
    public void CastSpell(SpellValues spell, CharacterValues caster, Tile currentMouseTile)
    {
        playerBehaviour.aControll.PlayAttack(caster);
        playerBehaviour.aControll.PlaySpell(spell);


        Tile casterTile = gridController.GetTile(caster.currentTile.x, caster.currentTile.z);
        Tile targetTile = currentMouseTile;
        //Tile temp1 = gridController.GetTile(caster.currentTile.x,caster.currentTile.z);
        //Tile temp2 = gridController.GetTile(target.currentTile.x,target.currentTile.z);
        List <Tile> targetsList = abilities.AreaType(currentSpell.mySpellAreaType);
        int         leach       = 0;

        foreach (var item in targetsList)
        {
            PlayerInfo      checker = item.CharCurrentlyOnTile;
            CharacterValues target  = null;
            if (checker)
            {
                target = checker.thisCharacter;
            }

            if (target)
            {
                int damageStuff  = 0;
                int healingIsFun = 0;

                if (spell.healsAlly == true)
                {
                    if (target.team == caster.team)
                    {
                        healingIsFun = TrueHealCalculator(spell.spellHealMax, spell.spellHealMin, target.healsReceived);
                    }
                    else
                    {
                        damageStuff = TrueDamageCalculator(spell.spellDamageMax, spell.spellDamageMin, caster.damageChange, target.armorChange, caster.damagePlus, target.armorPlus);
                    }
                }
                else if (spell.hurtsAlly == false)
                {
                    if (target.team != caster.team)
                    {
                        damageStuff = TrueDamageCalculator(spell.spellDamageMax, spell.spellDamageMin, caster.damageChange, target.armorChange, caster.damagePlus, target.armorPlus);
                    }
                }
                else
                {
                    damageStuff = TrueDamageCalculator(spell.spellDamageMax, spell.spellDamageMin, caster.damageChange, target.armorChange, caster.damagePlus, target.armorPlus);
                }
                leach = leach + damageStuff;
                GetHit(target, damageStuff);
                GetHealed(target, healingIsFun);
                if (spell.effect && spell.effectOnTarget == true && target != caster)
                {
                    sEffects.ApplyEffect(caster, spell.effect, target);
                    playerBehaviour.UpdateTabs();
                }
                if (spell.effect && spell.effectOnCaster == true && target == caster)
                {
                    sEffects.ApplyEffect(caster, spell.effect, target);
                    playerBehaviour.UpdateTabs();
                }
            }
        }
        if (spell.damageStealsHp == true)
        {
            StealHp(caster, leach);
        }
        if (spell.spellPull != 0)
        {
            //abilities.SpellPull(spell.mySpellPullType);
        }
        if (spell.spellPushback != 0)
        {
            //abilities.SpellPush(spell.mySpellPushType);
        }

        if (spell.moveCloserToTarget != 0)
        {
            //abilities.WalkTowardsTarget();
        }
        if (spell.moveAwayFromTarget != 0)
        {
            //abilities.MoveAwayFromTarget();
        }

        if (spell.teleportToTarget == true)
        {
            abilities.CasterTeleport(casterTile);
        }
        if (spell.chagePlaceWithTarget == true)
        {
            abilities.TeleportSwitch(casterTile, targetTile);
        }
        HandleCoolDownIncrease(spell);
        UpdateHpApMp();
    }