//Remove previous Mod and subtract bool void ModCharacterStats(BaseCharacter character, bool Add) { int MP = 1; if (!Add) { MP = -1; } foreach (StatModifier mod in Modifiers) { switch (mod.Stat) { case AttributeName.Level: Debug.LogWarning("Level Modding is not allowed at this time. Please contact Programming is needed"); break; case AttributeName.Strength: character.GetPrimaryAttribute((int)AttributeName.Strength).BuffValue += mod.BuffValue * MP; break; case AttributeName.Vitality: character.GetPrimaryAttribute((int)AttributeName.Vitality).BuffValue += mod.BuffValue * MP; break; case AttributeName.Awareness: character.GetPrimaryAttribute((int)AttributeName.Awareness).BuffValue += mod.BuffValue * MP; break; case AttributeName.Speed: character.GetPrimaryAttribute((int)AttributeName.Speed).BuffValue += mod.BuffValue * MP * MP; break; case AttributeName.Skill: character.GetPrimaryAttribute((int)AttributeName.Skill).BuffValue += mod.BuffValue * MP; break; case AttributeName.Resistance: character.GetPrimaryAttribute((int)AttributeName.Resistance).BuffValue += mod.BuffValue * MP; break; case AttributeName.Concentration: character.GetPrimaryAttribute((int)AttributeName.Concentration).BuffValue += mod.BuffValue * MP; break; case AttributeName.WillPower: character.GetPrimaryAttribute((int)AttributeName.WillPower).BuffValue += mod.BuffValue * MP; break; case AttributeName.Charisma: character.GetPrimaryAttribute((int)AttributeName.Charisma).BuffValue += mod.BuffValue * MP; break; case AttributeName.Luck: character.GetPrimaryAttribute((int)AttributeName.Luck).BuffValue += mod.BuffValue * MP; break; } } character.StatUpdate(); }
//Update is called once per frame void Update() { _player.StatUpdate(); if (_player.Exp != jScript.currentEXP) { _player.ExpToLvl = jScript.currentNEXT; Debug.Log(_player.ExpToLvl); if (addExp) { _player.AddExp(10); addExp = false; } Debug.Log(_player.Exp); _player.CalculateLevel(); if (_player.LevelUp) { Debug.Log("inside levelup if"); _player.LevelUp = false; Debug.Log(_player.LevelUp); jScript.currentLV++;; jScript.currentEXP = 0; jScript.fullHP += jScript.startATK * (Mathf.CeilToInt(jScript.currentLV / 2)); jScript.currentHP = jScript.fullHP; jScript.fullMP += jScript.startINT * (Mathf.CeilToInt(jScript.currentLV / 2)); jScript.currentMP = jScript.fullMP; jScript.currentNEXT = (int)(_player.ExpToLvlBase * _player.ExpModifier); jScript.levelUpATK += (int)(jScript.startATK * _player.StatModifier); jScript.levelUpINT += (int)(jScript.startINT * _player.StatModifier); jScript.levelUpAGI += (int)(jScript.startAGI * _player.StatModifier); if (jScript.currentLV % 5 == 0) { jScript.levelUpLCK += 1; } _player.ExpToLvl = jScript.currentNEXT; _player.ExpToLvlBase = _player.ExpToLvl; } } //remove dream special effects once dream sequence is over if (PlayerPrefs.GetInt("Story Progress") >= 9) { foreach (GameObject flare in GameObject.FindGameObjectsWithTag("dreamflare")) { Destroy(flare); } } }
public override void EquipItem(InventoryBase inventoryBase, EquipmentBase Equipment, int IndexOf, BaseCharacter player) { if (player.Level >= LevelRqd) { if (Model != null) { GameObject armorModel = Instantiate(Model); // Consider adding and enum as all character maybe not be human if (EquipToHuman) { Transform bone = player.GetComponent <Animator>().GetBoneTransform(EquipBone); if (bone) { armorModel.transform.SetParent(bone); } } } ModCharacterStats(player, true); switch (ArmorType) { case ArmorType.Arms: if (Equipment.Arms) { Equipment.Arms.Unequip(inventoryBase, Equipment, player, 0); } Equipment.Arms = this; break; case ArmorType.Shield: if (Equipment.Shield) { Equipment.Shield.Unequip(inventoryBase, Equipment, player, 0); } Equipment.Shield = this; break; case ArmorType.Chest: if (Equipment.Chest) { Equipment.Chest.Unequip(inventoryBase, Equipment, player, 0); } Equipment.Chest = this; break; case ArmorType.Helmet: if (Equipment.Helmet) { Equipment.Helmet.Unequip(inventoryBase, Equipment, player, 0); } Equipment.Helmet = this; break; case ArmorType.Legs: if (Equipment.Legs) { Equipment.Legs.Unequip(inventoryBase, Equipment, player, 0); } Equipment.Legs = this; break; case ArmorType.Signature: if (Equipment.Signature) { Equipment.Signature.Unequip(inventoryBase, Equipment, player, 0); } Equipment.Signature = this; break; } RemoveFromInventory(inventoryBase, IndexOf); player.StatUpdate(); } else { Debug.LogWarning("Level required to Equip is " + LevelRqd + ". Character is currently level " + player.Level); } }