Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public bool EquipWeapon(int player, GameObject weaponcard, int slot, bool free)//1-2) to handslot dn xrisimopoihte
- {
- bool summon = false;
- if (player == 1)
- {
- if (free || (MatchControl.mcontrol.player1mana >= weaponcard.GetComponent<WeaponCardAttributes>().manacost && MatchControl.mcontrol.player1energy >= weaponcard.GetComponent<WeaponCardAttributes>().altcost))
- {
- summon = true;
- if (MatchControl.mcontrol.weaponslots1[0] == null)
- weaponcard.GetComponent<WeaponCardAttributes>().wslot = 1;
- else if (weaponcard.GetComponent<WeaponCardAttributes>().twohanded == 0 && MatchControl.mcontrol.weaponslots1[1] == null)
- weaponcard.GetComponent<WeaponCardAttributes>().wslot = 2;
- else if (weaponcard.GetComponent<WeaponCardAttributes>().twohanded == 0)
- weaponcard.GetComponent<WeaponCardAttributes>().wslot = slot;
- else
- weaponcard.GetComponent<WeaponCardAttributes>().wslot = 1;
- if (weaponcard.GetComponent<WeaponCardAttributes>().wslot == 1)
- {
- AddAncientWeapon(1, 0);
- }
- else
- {
- AddAncientWeapon(1, 1);
- }
- if (!free)
- {
- MatchControl.mcontrol.player1mana -= weaponcard.GetComponent<WeaponCardAttributes>().manacost;
- MatchControl.mcontrol.player1energy -= weaponcard.GetComponent<WeaponCardAttributes>().altcost;
- }
- if (weaponcard.GetComponent<WeaponCardAttributes>().twohanded == 0)
- {
- if (MatchControl.mcontrol.weaponslots1[0] == null)
- {
- MatchControl.mcontrol.weaponslots1[0] = weaponcard;
- MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().handrecovery1 = MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().cheatedrecovery1;
- MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().cheatedrecovery1 = 0;
- }
- else if (MatchControl.mcontrol.weaponslots1[0].GetComponent<WeaponCardAttributes>().twohanded == 1)
- {
- DestroyWeapon(MatchControl.mcontrol.weaponslots1[0]);
- MatchControl.mcontrol.weaponslots1[0] = weaponcard;
- MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().handrecovery1 = MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().cheatedrecovery1;
- MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().cheatedrecovery1 = 0;
- }
- else //if(weaponcard.GetComponent<WeaponCardAttributes>().wslot != 1)
- {
- if (MatchControl.mcontrol.weaponslots1[slot - 1] != null)
- DestroyWeapon(MatchControl.mcontrol.weaponslots1[slot - 1]);
- //na graftei kwdikas na katastrefetai to oplo edw
- MatchControl.mcontrol.weaponslots1[slot - 1] = weaponcard;
- if (slot - 1 == 0)
- {
- MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().handrecovery1 = MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().cheatedrecovery1;
- MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().cheatedrecovery1 = 0;
- }
- else
- {
- MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().handrecovery2 = MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().cheatedrecovery2;
- MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().cheatedrecovery2 = 0;
- }
- }
- }
- //override,if we are equipping a 1h weapon,if slot 1 is empty , it will be assigned there(100% no 2h already),otherwise,we will check if there is a 2 handed in
- //slot 1,if there isnt,it will be equipped in the slot the system assigned it with no error,keeping both 1h weapons (or overriding one),otherwise
- //the 2h weapon will be removed (slot 1 nulled) and the weapon will be auto assigned into slot 2
- else
- {
- if (MatchControl.mcontrol.weaponslots1[0] != null)
- {
- DestroyWeapon(MatchControl.mcontrol.weaponslots1[0]);
- }
- if (MatchControl.mcontrol.weaponslots1[1] != null)
- {
- DestroyWeapon(MatchControl.mcontrol.weaponslots1[1]);
- }
- MatchControl.mcontrol.weaponslots1[slot - 1] = weaponcard;
- MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().handrecovery1 = MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().cheatedrecovery1;
- MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().handrecovery2 = MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().cheatedrecovery2;
- MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().cheatedrecovery1=0;
- MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().cheatedrecovery2=0;
- //na graftei kwdikas na katastrefetai to oplo edw
- //override,if it is twohanded slot 1 will be the weapon and slot 2 will be nulled regardless of what existed
- }
- /*Refresh hand out of function
- MatchControl.mcontrol.player1cards[handslot] = null;
- if (handslot < 10)
- {
- for (int i = handslot; i < 9 && MatchControl.mcontrol.player1cards[i + 1] != null; i++)
- {
- MatchControl.mcontrol.player1cards[i] = MatchControl.mcontrol.player1cards[i + 1];
- }
- MatchControl.mcontrol.player1cards[9] = null;
- }
- else
- {
- for (int i = handslot; i < 19 && MatchControl.mcontrol.player1cards[i + 1] != null; i++)
- {
- MatchControl.mcontrol.player1cards[i] = MatchControl.mcontrol.player1cards[i + 1];
- }
- MatchControl.mcontrol.player1cards[19] = null;
- }*/
- //??MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().defence += weaponcard.GetComponent<WeaponCardAttributes>().defence;
- // MatchControl.mcontrol.player1handamount--;//might need to invoke differently if i need to summon from deck/nowhere
- TriggerEvents(MatchControl.mcontrol.WeaponEquipped1EventEffects);
- //battlecry?
- }
- else
- {
- //show notification not enough mana?
- }
- }
- else
- {
- if (free || (MatchControl.mcontrol.player2mana >= weaponcard.GetComponent<WeaponCardAttributes>().manacost && MatchControl.mcontrol.player2energy >= weaponcard.GetComponent<WeaponCardAttributes>().altcost))
- {
- summon = true;
- if (MatchControl.mcontrol.weaponslots2[0] == null)
- weaponcard.GetComponent<WeaponCardAttributes>().wslot = 1;
- else if (weaponcard.GetComponent<WeaponCardAttributes>().twohanded == 0 && MatchControl.mcontrol.weaponslots2[1] == null)
- weaponcard.GetComponent<WeaponCardAttributes>().wslot = 2;
- else if (weaponcard.GetComponent<WeaponCardAttributes>().twohanded == 0)
- weaponcard.GetComponent<WeaponCardAttributes>().wslot = slot;
- else
- weaponcard.GetComponent<WeaponCardAttributes>().wslot = 1;
- if (weaponcard.GetComponent<WeaponCardAttributes>().wslot == 1)
- {
- AddAncientWeapon(2, 0);
- }
- else
- {
- AddAncientWeapon(2, 1);
- }
- if (!free)
- {
- MatchControl.mcontrol.player2mana -= weaponcard.GetComponent<WeaponCardAttributes>().manacost;
- MatchControl.mcontrol.player2energy -= weaponcard.GetComponent<WeaponCardAttributes>().altcost;
- }
- if (weaponcard.GetComponent<WeaponCardAttributes>().twohanded == 0)
- {
- if (MatchControl.mcontrol.weaponslots2[0] == null)
- {
- MatchControl.mcontrol.weaponslots2[slot - 1] = weaponcard;
- MatchControl.mcontrol.hero2.GetComponent<HeroCardAttributes>().handrecovery1 = MatchControl.mcontrol.hero2.GetComponent<HeroCardAttributes>().cheatedrecovery1;
- MatchControl.mcontrol.hero2.GetComponent<HeroCardAttributes>().cheatedrecovery1 = 0;
- }
- else if (MatchControl.mcontrol.weaponslots2[0].GetComponent<WeaponCardAttributes>().twohanded == 1)
- {
- DestroyWeapon(MatchControl.mcontrol.weaponslots2[0]);
- MatchControl.mcontrol.weaponslots2[0] = weaponcard;
- MatchControl.mcontrol.hero2.GetComponent<HeroCardAttributes>().handrecovery1 = MatchControl.mcontrol.hero2.GetComponent<HeroCardAttributes>().cheatedrecovery1;
- MatchControl.mcontrol.hero2.GetComponent<HeroCardAttributes>().cheatedrecovery1 = 0;
- }
- else //if(weaponcard.GetComponent<WeaponCardAttributes>().wslot != 1)
- {
- if(MatchControl.mcontrol.weaponslots2[slot - 1]!=null)
- DestroyWeapon(MatchControl.mcontrol.weaponslots2[slot - 1]);
- //na graftei kwdikas na katastrefetai to oplo edw
- MatchControl.mcontrol.weaponslots2[slot - 1] = weaponcard;
- if (slot - 1 == 0)
- {
- MatchControl.mcontrol.hero2.GetComponent<HeroCardAttributes>().handrecovery1 = MatchControl.mcontrol.hero2.GetComponent<HeroCardAttributes>().cheatedrecovery1;
- MatchControl.mcontrol.hero2.GetComponent<HeroCardAttributes>().cheatedrecovery1 = 0;
- }
- else
- {
- MatchControl.mcontrol.hero2.GetComponent<HeroCardAttributes>().handrecovery2 = MatchControl.mcontrol.hero2.GetComponent<HeroCardAttributes>().cheatedrecovery2;
- MatchControl.mcontrol.hero2.GetComponent<HeroCardAttributes>().cheatedrecovery2 = 0;
- }
- }
- }
- //override,if we are equipping a 1h weapon,if slot 1 is empty , it will be assigned there(100% no 2h already),otherwise,we will check if there is a 2 handed in
- //slot 1,if there isnt,it will be equipped in the slot the system assigned it with no error,keeping both 1h weapons (or overriding one),otherwise
- //the 2h weapon will be removed (slot 1 nulled) and the weapon will be auto assigned into slot 2
- else
- {
- if (MatchControl.mcontrol.weaponslots2[0] != null)
- {
- DestroyWeapon(MatchControl.mcontrol.weaponslots2[0]);
- }
- if (MatchControl.mcontrol.weaponslots2[1] != null)
- {
- DestroyWeapon(MatchControl.mcontrol.weaponslots2[1]);
- }
- MatchControl.mcontrol.weaponslots2[slot - 1] = weaponcard;
- MatchControl.mcontrol.hero2.GetComponent<HeroCardAttributes>().handrecovery1 = MatchControl.mcontrol.hero2.GetComponent<HeroCardAttributes>().cheatedrecovery1;
- MatchControl.mcontrol.hero2.GetComponent<HeroCardAttributes>().cheatedrecovery1 = 0;
- MatchControl.mcontrol.hero2.GetComponent<HeroCardAttributes>().handrecovery2 = MatchControl.mcontrol.hero2.GetComponent<HeroCardAttributes>().cheatedrecovery2;
- MatchControl.mcontrol.hero2.GetComponent<HeroCardAttributes>().cheatedrecovery2 = 0;
- //na graftei kwdikas na katastrefetai to oplo edw
- //override,if it is twohanded slot 1 will be the weapon and slot 2 will be nulled regardless of what existed
- }
- /*Refresh hand out of function
- MatchControl.mcontrol.player1cards[handslot] = null;
- if (handslot < 10)
- {
- for (int i = handslot; i < 9 && MatchControl.mcontrol.player1cards[i + 1] != null; i++)
- {
- MatchControl.mcontrol.player1cards[i] = MatchControl.mcontrol.player1cards[i + 1];
- }
- MatchControl.mcontrol.player1cards[9] = null;
- }
- else
- {
- for (int i = handslot; i < 19 && MatchControl.mcontrol.player1cards[i + 1] != null; i++)
- {
- MatchControl.mcontrol.player1cards[i] = MatchControl.mcontrol.player1cards[i + 1];
- }
- MatchControl.mcontrol.player1cards[19] = null;
- }*/
- //??MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().defence += weaponcard.GetComponent<WeaponCardAttributes>().defence;
- TriggerEvents(MatchControl.mcontrol.WeaponEquipped2EventEffects);//might need to invoke differently if i need to summon from deck/nowhere
- //battlecry?
- }
- else
- {
- //show notification not enough mana?
- }
- }
- return summon;
- }
Advertisement
Add Comment
Please, Sign In to add comment