public void ChangeArmor(ItemPickUp armorPickUp) { if (!characterDefinition.UnEquipArmor(armorPickUp, inventory)) { characterDefinition.EquipArmor(armorPickUp, inventory); } }
public void ChangeWeapon(ItemPickUp weaponPickUp) { if (!characterDefinition.UnEquipWeapon(weaponPickUp, inventory, characterWeaponSlot)) { Debug.LogError("Nice sec"); characterDefinition.EquipWeapon(weaponPickUp, inventory, characterWeaponSlot); } }
public void EquipSkill(ItemPickUp skillPickUp, CharacterInv charInv) { //.... var BuffItemsType = skillPickUp.itemDefinition.ItemType.Where(item => item == ItemType.BUFF); if (skillPickUp.itemDefinition.ItemBuffScholl != ItemBuffScholl.ULTI) { CharSkills.spellBuffer = skillPickUp; if (skillIsChangedByPickUpItem != null) { skillIsChangedByPickUpItem.Invoke(true); } } else if (skillPickUp.itemDefinition.ItemBuffScholl == ItemBuffScholl.ULTI) { CharSkills.UltimateSpellBuffer = skillPickUp; if (skillIsChangedByPickUpItem != null) { skillIsChangedByPickUpItem.Invoke(true); } } }
public void ChangeAbilitySkill(ItemPickUp skillToEquip) { characterDefinition.EquipSkill(skillToEquip, inventory); }
//Set the first ability spell of the character CharacterStats_SO=>EquipSkill public void SetInitialAbilitySpell(ItemPickUp abilitySpell) { characterDefinition.EquipSkill(abilitySpell, inventory); }
public bool UnEquipArmor(ItemPickUp armorToUnEquip, CharacterInv characterInv) { bool previousArmorSame = false; switch (armorToUnEquip.itemDefinition.ItemSubType) { case ItemArmorSubType.HEAD: if (headArmor != null) { if (headArmor == armorToUnEquip) { previousArmorSame = true; } foreach (var stat in armorToUnEquip.itemDefinition.ItemArmorStatsSubType) { switch (stat) { case ItemStatsToAddSubType.MAGICDAMAGE: currentMagicDamage -= armorToUnEquip.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.MAGICRESSISTANCE: currentSpellResistance -= armorToUnEquip.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.DAMAGE: currentDamage -= armorToUnEquip.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.RESSISTANCE: currentResistance -= armorToUnEquip.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.MANA: currentMana -= armorToUnEquip.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.HP: currentHealth -= armorToUnEquip.itemDefinition.itemAmount; break; } } headArmor = null; } break; case ItemArmorSubType.CHEST: if (chestArmor != null) { if (chestArmor == armorToUnEquip) { previousArmorSame = true; } foreach (var stat in armorToUnEquip.itemDefinition.ItemArmorStatsSubType) { switch (stat) { case ItemStatsToAddSubType.MAGICDAMAGE: currentMagicDamage -= armorToUnEquip.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.MAGICRESSISTANCE: currentSpellResistance -= armorToUnEquip.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.DAMAGE: currentDamage -= armorToUnEquip.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.RESSISTANCE: currentResistance -= armorToUnEquip.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.MANA: currentMana -= armorToUnEquip.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.HP: currentHealth -= armorToUnEquip.itemDefinition.itemAmount; break; } } chestArmor = null; } break; case ItemArmorSubType.HANDS: if (handArmor != null) { if (handArmor == armorToUnEquip) { previousArmorSame = true; } foreach (var stat in armorToUnEquip.itemDefinition.ItemArmorStatsSubType) { switch (stat) { case ItemStatsToAddSubType.MAGICDAMAGE: currentMagicDamage -= armorToUnEquip.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.MAGICRESSISTANCE: currentSpellResistance -= armorToUnEquip.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.DAMAGE: currentDamage -= armorToUnEquip.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.RESSISTANCE: currentResistance -= armorToUnEquip.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.MANA: currentMana -= armorToUnEquip.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.HP: currentHealth -= armorToUnEquip.itemDefinition.itemAmount; break; } } handArmor = null; } break; case ItemArmorSubType.LEGS: if (legArmor != null) { if (legArmor = armorToUnEquip) { previousArmorSame = true; } foreach (var stat in armorToUnEquip.itemDefinition.ItemArmorStatsSubType) { switch (stat) { case ItemStatsToAddSubType.MAGICDAMAGE: currentMagicDamage -= armorToUnEquip.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.MAGICRESSISTANCE: currentSpellResistance -= armorToUnEquip.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.DAMAGE: currentDamage -= armorToUnEquip.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.RESSISTANCE: currentResistance -= armorToUnEquip.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.MANA: currentMana -= armorToUnEquip.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.HP: currentHealth -= armorToUnEquip.itemDefinition.itemAmount; break; } } legArmor = null; } break; case ItemArmorSubType.BOOTS: if (footArmor != null) { if (footArmor == armorToUnEquip) { previousArmorSame = true; } foreach (var stat in armorToUnEquip.itemDefinition.ItemArmorStatsSubType) { switch (stat) { case ItemStatsToAddSubType.MAGICDAMAGE: currentMagicDamage -= armorToUnEquip.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.MAGICRESSISTANCE: currentSpellResistance -= armorToUnEquip.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.DAMAGE: currentDamage -= armorToUnEquip.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.RESSISTANCE: currentResistance -= armorToUnEquip.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.MANA: currentMana -= armorToUnEquip.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.HP: currentHealth -= armorToUnEquip.itemDefinition.itemAmount; break; } } footArmor = null; } break; } return(previousArmorSame); }
public bool UnEquipWeapon(ItemPickUp weaponToUnEquip, CharacterInv characterInv, GameObject weaponSlot) { bool previousWeaponSame = false; if (weaponToUnEquip.itemDefinition.itemWeaponSubType == ItemWeaponSubType.Melee) { if (weaponMelee != null) { if (weaponMelee == weaponToUnEquip) { previousWeaponSame = true; } // DestroyObject(weaponSlot.transform.GetChild(0).gameObject); weaponMelee = null; foreach (var stat in weaponToUnEquip.itemDefinition.ItemArmorStatsSubType) { switch (stat) { case ItemStatsToAddSubType.MANA: currentMana -= weaponToUnEquip.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.HP: currentHealth -= weaponToUnEquip.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.MAGICDAMAGE: currentMagicDamage -= weaponToUnEquip.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.DAMAGE: currentDamage -= weaponToUnEquip.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.MAGICRESSISTANCE: currentSpellResistance -= weaponToUnEquip.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.RESSISTANCE: currentResistance -= weaponToUnEquip.itemDefinition.itemAmount; break; } } } } else if (weaponToUnEquip.itemDefinition.itemWeaponSubType == ItemWeaponSubType.Range) { if (weaponRange != null) { if (weaponRange == weaponToUnEquip) { previousWeaponSame = true; } //DestroyObject(weaponSlot.transform.GetChild(0).gameObject); weaponRange = null; foreach (var stat in weaponToUnEquip.itemDefinition.ItemArmorStatsSubType) { switch (stat) { case ItemStatsToAddSubType.MANA: currentMana -= weaponToUnEquip.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.HP: currentHealth -= weaponToUnEquip.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.MAGICDAMAGE: currentMagicDamage -= weaponToUnEquip.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.DAMAGE: currentDamage -= weaponToUnEquip.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.MAGICRESSISTANCE: currentSpellResistance -= weaponToUnEquip.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.RESSISTANCE: currentResistance -= weaponToUnEquip.itemDefinition.itemAmount; break; } } } } return(previousWeaponSame); }
public void EquipArmor(ItemPickUp armorPickUp, CharacterInv charInv) { //Check to find out itemSubType (HEAD,CHEST,LEGS, e.t.c) switch (armorPickUp.itemDefinition.ItemSubType) { case ItemArmorSubType.HEAD: //Equip in HEAD slot headArmor = armorPickUp; //Loop to find out all itemArmorStatsSubType`s to add for (int i = 0; i < armorPickUp.itemDefinition.ItemArmorStatsSubType.Length; i++) { //Check to find out itemArmorStatsSubType to add switch (armorPickUp.itemDefinition.ItemArmorStatsSubType[i]) { //Stat to add - DAMAGE case ItemStatsToAddSubType.DAMAGE: currentDamage += armorPickUp.itemDefinition.itemAmount; break; //Stat to add - MAGIC DAMAGE case ItemStatsToAddSubType.MAGICDAMAGE: currentMagicDamage += baseMagicDamage + armorPickUp.itemDefinition.itemAmount; break; //Stat to add - MAGICRESSISTANCE case ItemStatsToAddSubType.MAGICRESSISTANCE: currentSpellResistance += armorPickUp.itemDefinition.itemAmount; break; //Stat to add - RESSISTANCE case ItemStatsToAddSubType.RESSISTANCE: currentResistance += armorPickUp.itemDefinition.itemAmount; break; //Stat to add - HP case ItemStatsToAddSubType.HP: currentHealth += armorPickUp.itemDefinition.itemAmount; break; //Stat to add - MANA case ItemStatsToAddSubType.MANA: currentMana += armorPickUp.itemDefinition.itemAmount; break; } } break; case ItemArmorSubType.CHEST: //Equip in CHEST slot chestArmor = armorPickUp; for (int i = 0; i < armorPickUp.itemDefinition.ItemArmorStatsSubType.Length; i++) { switch (armorPickUp.itemDefinition.ItemArmorStatsSubType[i]) { case ItemStatsToAddSubType.DAMAGE: currentDamage += armorPickUp.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.MAGICDAMAGE: currentMagicDamage += armorPickUp.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.MAGICRESSISTANCE: currentSpellResistance += armorPickUp.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.RESSISTANCE: currentResistance += armorPickUp.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.HP: currentHealth += armorPickUp.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.MANA: currentMana += armorPickUp.itemDefinition.itemAmount; break; } } break; case ItemArmorSubType.BOOTS: //Equip in BOOTS slot footArmor = armorPickUp; for (int i = 0; i < armorPickUp.itemDefinition.ItemArmorStatsSubType.Length; i++) { switch (armorPickUp.itemDefinition.ItemArmorStatsSubType[i]) { case ItemStatsToAddSubType.DAMAGE: currentDamage += armorPickUp.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.MAGICDAMAGE: currentMagicDamage += armorPickUp.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.MAGICRESSISTANCE: currentSpellResistance += armorPickUp.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.RESSISTANCE: currentResistance += armorPickUp.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.HP: currentHealth += armorPickUp.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.MANA: currentMana += armorPickUp.itemDefinition.itemAmount; break; } } break; case ItemArmorSubType.HANDS: ////Equip in HANDS slot handArmor = armorPickUp; for (int i = 0; i < armorPickUp.itemDefinition.ItemArmorStatsSubType.Length; i++) { switch (armorPickUp.itemDefinition.ItemArmorStatsSubType[i]) { case ItemStatsToAddSubType.DAMAGE: currentDamage += armorPickUp.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.MAGICDAMAGE: currentMagicDamage += armorPickUp.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.MAGICRESSISTANCE: currentSpellResistance += armorPickUp.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.RESSISTANCE: currentResistance += armorPickUp.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.HP: currentHealth += armorPickUp.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.MANA: currentMana += armorPickUp.itemDefinition.itemAmount; break; } } break; case ItemArmorSubType.LEGS: ////Equip in LEGS slot legArmor = armorPickUp; for (int i = 0; i < armorPickUp.itemDefinition.ItemArmorStatsSubType.Length; i++) { switch (armorPickUp.itemDefinition.ItemArmorStatsSubType[i]) { case ItemStatsToAddSubType.DAMAGE: currentDamage += armorPickUp.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.MAGICDAMAGE: currentMagicDamage += armorPickUp.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.MAGICRESSISTANCE: currentSpellResistance += armorPickUp.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.RESSISTANCE: currentResistance += armorPickUp.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.HP: currentHealth += armorPickUp.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.MANA: currentMana += armorPickUp.itemDefinition.itemAmount; break; } } break; } }
public CharSkill CharSkills; // CHAR SKILLS CLASS(CONTAINER) #endregion #region Equip Items public void EquipWeapon(ItemPickUp weaponPickUp, CharacterInv charInv, GameObject weaponSlot) { // var weaponPickUpTypes = weaponPickUp.itemDefinition.ItemType.Where(item => item == ItemType.WEAPON); if (weaponPickUp.itemDefinition.itemWeaponSubType == ItemWeaponSubType.Melee) { weaponMelee = weaponPickUp; foreach (var stat in weaponPickUp.itemDefinition.ItemArmorStatsSubType) { switch (stat) { case ItemStatsToAddSubType.DAMAGE: currentDamage += weaponPickUp.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.MAGICDAMAGE: currentMagicDamage += weaponPickUp.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.HP: currentHealth += weaponPickUp.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.MANA: currentMana += weaponPickUp.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.RESSISTANCE: currentResistance += weaponPickUp.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.MAGICRESSISTANCE: currentSpellResistance += weaponPickUp.itemDefinition.itemAmount; break; } } } else if (weaponPickUp.itemDefinition.itemWeaponSubType == ItemWeaponSubType.Range) { weaponRange = weaponPickUp; foreach (var stat in weaponPickUp.itemDefinition.ItemArmorStatsSubType) { switch (stat) { case ItemStatsToAddSubType.DAMAGE: currentDamage += weaponPickUp.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.MAGICDAMAGE: currentMagicDamage += weaponPickUp.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.HP: currentHealth += weaponPickUp.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.MANA: currentMana += weaponPickUp.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.RESSISTANCE: currentResistance += weaponPickUp.itemDefinition.itemAmount; break; case ItemStatsToAddSubType.MAGICRESSISTANCE: currentSpellResistance += weaponPickUp.itemDefinition.itemAmount; break; } } } }