Guest User

Untitled

a guest
Jan 12th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 14.23 KB | None | 0 0
  1.  public bool EquipWeapon(int player, GameObject weaponcard, int slot, bool free)//1-2) to handslot dn xrisimopoihte
  2.     {
  3.         bool summon = false;
  4.         if (player == 1)
  5.         {
  6.             if (free || (MatchControl.mcontrol.player1mana >= weaponcard.GetComponent<WeaponCardAttributes>().manacost && MatchControl.mcontrol.player1energy >= weaponcard.GetComponent<WeaponCardAttributes>().altcost))
  7.             {
  8.                 summon = true;
  9.  
  10.                 if (MatchControl.mcontrol.weaponslots1[0] == null)
  11.                     weaponcard.GetComponent<WeaponCardAttributes>().wslot = 1;
  12.                 else if (weaponcard.GetComponent<WeaponCardAttributes>().twohanded == 0 && MatchControl.mcontrol.weaponslots1[1] == null)
  13.                     weaponcard.GetComponent<WeaponCardAttributes>().wslot = 2;
  14.                 else if (weaponcard.GetComponent<WeaponCardAttributes>().twohanded == 0)
  15.                     weaponcard.GetComponent<WeaponCardAttributes>().wslot = slot;
  16.                 else
  17.                     weaponcard.GetComponent<WeaponCardAttributes>().wslot = 1;
  18.  
  19.                 if (weaponcard.GetComponent<WeaponCardAttributes>().wslot == 1)
  20.                 {
  21.                     AddAncientWeapon(1, 0);
  22.                 }
  23.                 else
  24.                 {
  25.                     AddAncientWeapon(1, 1);
  26.  
  27.                 }
  28.                 if (!free)
  29.                 {
  30.                     MatchControl.mcontrol.player1mana -= weaponcard.GetComponent<WeaponCardAttributes>().manacost;
  31.                     MatchControl.mcontrol.player1energy -= weaponcard.GetComponent<WeaponCardAttributes>().altcost;
  32.                 }
  33.                 if (weaponcard.GetComponent<WeaponCardAttributes>().twohanded == 0)
  34.                 {
  35.                     if (MatchControl.mcontrol.weaponslots1[0] == null)
  36.                     {
  37.                         MatchControl.mcontrol.weaponslots1[0] = weaponcard;
  38.                         MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().handrecovery1 = MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().cheatedrecovery1;
  39.                         MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().cheatedrecovery1 = 0;
  40.                     }
  41.                     else if (MatchControl.mcontrol.weaponslots1[0].GetComponent<WeaponCardAttributes>().twohanded == 1)
  42.                     {
  43.                         DestroyWeapon(MatchControl.mcontrol.weaponslots1[0]);
  44.                         MatchControl.mcontrol.weaponslots1[0] = weaponcard;
  45.                         MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().handrecovery1 = MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().cheatedrecovery1;
  46.                         MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().cheatedrecovery1 = 0;
  47.                     }
  48.                     else //if(weaponcard.GetComponent<WeaponCardAttributes>().wslot != 1)
  49.                     {
  50.                         if (MatchControl.mcontrol.weaponslots1[slot - 1] != null)
  51.                             DestroyWeapon(MatchControl.mcontrol.weaponslots1[slot - 1]);
  52.                         //na graftei kwdikas na katastrefetai to oplo edw
  53.                         MatchControl.mcontrol.weaponslots1[slot - 1] = weaponcard;
  54.                         if (slot - 1 == 0)
  55.                         {
  56.                             MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().handrecovery1 = MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().cheatedrecovery1;
  57.                             MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().cheatedrecovery1 = 0;
  58.                         }
  59.                         else
  60.                         {
  61.                             MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().handrecovery2 = MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().cheatedrecovery2;
  62.                             MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().cheatedrecovery2 = 0;
  63.                         }
  64.  
  65.  
  66.                     }
  67.                 }
  68.                 //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
  69.                 //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
  70.                 //the 2h weapon will be removed (slot 1 nulled) and the weapon will be auto assigned into slot 2
  71.                 else
  72.                 {
  73.                     if (MatchControl.mcontrol.weaponslots1[0] != null)
  74.                     {
  75.                         DestroyWeapon(MatchControl.mcontrol.weaponslots1[0]);
  76.                     }
  77.                     if (MatchControl.mcontrol.weaponslots1[1] != null)
  78.                     {
  79.                         DestroyWeapon(MatchControl.mcontrol.weaponslots1[1]);
  80.                     }
  81.                     MatchControl.mcontrol.weaponslots1[slot - 1] = weaponcard;
  82.                     MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().handrecovery1 = MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().cheatedrecovery1;
  83.                     MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().handrecovery2 = MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().cheatedrecovery2;
  84.                     MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().cheatedrecovery1=0;
  85.                     MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().cheatedrecovery2=0;
  86.  
  87.                     //na graftei kwdikas na katastrefetai to oplo edw
  88.                     //override,if it is twohanded slot 1 will be the weapon and slot 2 will be nulled regardless of what existed
  89.                 }
  90.  
  91.                 /*Refresh hand out of function
  92.                 MatchControl.mcontrol.player1cards[handslot] = null;
  93.                 if (handslot < 10)
  94.                 {
  95.                     for (int i = handslot; i < 9 && MatchControl.mcontrol.player1cards[i + 1] != null; i++)
  96.                     {
  97.                         MatchControl.mcontrol.player1cards[i] = MatchControl.mcontrol.player1cards[i + 1];
  98.                     }
  99.                     MatchControl.mcontrol.player1cards[9] = null;
  100.                 }
  101.                 else
  102.                 {
  103.                     for (int i = handslot; i < 19 && MatchControl.mcontrol.player1cards[i + 1] != null; i++)
  104.                     {
  105.                         MatchControl.mcontrol.player1cards[i] = MatchControl.mcontrol.player1cards[i + 1];
  106.                     }
  107.                     MatchControl.mcontrol.player1cards[19] = null;
  108.                 }*/
  109.                 //??MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().defence += weaponcard.GetComponent<WeaponCardAttributes>().defence;
  110.                 //  MatchControl.mcontrol.player1handamount--;//might need to invoke differently if i need to summon from deck/nowhere
  111.                 TriggerEvents(MatchControl.mcontrol.WeaponEquipped1EventEffects);
  112.                
  113.                 //battlecry?
  114.             }
  115.             else
  116.             {
  117.                 //show notification not enough mana?
  118.             }
  119.         }
  120.         else
  121.         {
  122.             if (free || (MatchControl.mcontrol.player2mana >= weaponcard.GetComponent<WeaponCardAttributes>().manacost && MatchControl.mcontrol.player2energy >= weaponcard.GetComponent<WeaponCardAttributes>().altcost))
  123.             {
  124.                 summon = true;
  125.  
  126.                 if (MatchControl.mcontrol.weaponslots2[0] == null)
  127.                     weaponcard.GetComponent<WeaponCardAttributes>().wslot = 1;
  128.                 else if (weaponcard.GetComponent<WeaponCardAttributes>().twohanded == 0 && MatchControl.mcontrol.weaponslots2[1] == null)
  129.                     weaponcard.GetComponent<WeaponCardAttributes>().wslot = 2;
  130.                 else if (weaponcard.GetComponent<WeaponCardAttributes>().twohanded == 0)
  131.                     weaponcard.GetComponent<WeaponCardAttributes>().wslot = slot;
  132.                 else
  133.                     weaponcard.GetComponent<WeaponCardAttributes>().wslot = 1;
  134.  
  135.  
  136.                 if (weaponcard.GetComponent<WeaponCardAttributes>().wslot == 1)
  137.                 {
  138.                     AddAncientWeapon(2, 0);
  139.                 }
  140.                 else
  141.                 {
  142.                     AddAncientWeapon(2, 1);
  143.  
  144.                 }
  145.  
  146.                 if (!free)
  147.                 {
  148.                     MatchControl.mcontrol.player2mana -= weaponcard.GetComponent<WeaponCardAttributes>().manacost;
  149.                     MatchControl.mcontrol.player2energy -= weaponcard.GetComponent<WeaponCardAttributes>().altcost;
  150.                 }
  151.                 if (weaponcard.GetComponent<WeaponCardAttributes>().twohanded == 0)
  152.                 {
  153.                     if (MatchControl.mcontrol.weaponslots2[0] == null)
  154.                     {
  155.                         MatchControl.mcontrol.weaponslots2[slot - 1] = weaponcard;
  156.                         MatchControl.mcontrol.hero2.GetComponent<HeroCardAttributes>().handrecovery1 = MatchControl.mcontrol.hero2.GetComponent<HeroCardAttributes>().cheatedrecovery1;
  157.                         MatchControl.mcontrol.hero2.GetComponent<HeroCardAttributes>().cheatedrecovery1 = 0;
  158.                     }
  159.                     else if (MatchControl.mcontrol.weaponslots2[0].GetComponent<WeaponCardAttributes>().twohanded == 1)
  160.                     {
  161.                         DestroyWeapon(MatchControl.mcontrol.weaponslots2[0]);
  162.                         MatchControl.mcontrol.weaponslots2[0] = weaponcard;
  163.                         MatchControl.mcontrol.hero2.GetComponent<HeroCardAttributes>().handrecovery1 = MatchControl.mcontrol.hero2.GetComponent<HeroCardAttributes>().cheatedrecovery1;
  164.                         MatchControl.mcontrol.hero2.GetComponent<HeroCardAttributes>().cheatedrecovery1 = 0;
  165.                     }
  166.                     else //if(weaponcard.GetComponent<WeaponCardAttributes>().wslot != 1)
  167.                     {
  168.                         if(MatchControl.mcontrol.weaponslots2[slot - 1]!=null)
  169.                             DestroyWeapon(MatchControl.mcontrol.weaponslots2[slot - 1]);
  170.                         //na graftei kwdikas na katastrefetai to oplo edw
  171.                         MatchControl.mcontrol.weaponslots2[slot - 1] = weaponcard;
  172.                         if (slot - 1 == 0)
  173.                         {
  174.                             MatchControl.mcontrol.hero2.GetComponent<HeroCardAttributes>().handrecovery1 = MatchControl.mcontrol.hero2.GetComponent<HeroCardAttributes>().cheatedrecovery1;
  175.                             MatchControl.mcontrol.hero2.GetComponent<HeroCardAttributes>().cheatedrecovery1 = 0;
  176.                         }
  177.                         else
  178.                         {
  179.                             MatchControl.mcontrol.hero2.GetComponent<HeroCardAttributes>().handrecovery2 = MatchControl.mcontrol.hero2.GetComponent<HeroCardAttributes>().cheatedrecovery2;
  180.                             MatchControl.mcontrol.hero2.GetComponent<HeroCardAttributes>().cheatedrecovery2 = 0;
  181.                         }
  182.                     }
  183.                 }
  184.                 //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
  185.                 //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
  186.                 //the 2h weapon will be removed (slot 1 nulled) and the weapon will be auto assigned into slot 2
  187.                 else
  188.                 {
  189.                     if (MatchControl.mcontrol.weaponslots2[0] != null)
  190.                     {
  191.                         DestroyWeapon(MatchControl.mcontrol.weaponslots2[0]);
  192.                     }
  193.                     if (MatchControl.mcontrol.weaponslots2[1] != null)
  194.                     {
  195.                         DestroyWeapon(MatchControl.mcontrol.weaponslots2[1]);
  196.                     }
  197.                     MatchControl.mcontrol.weaponslots2[slot - 1] = weaponcard;
  198.                     MatchControl.mcontrol.hero2.GetComponent<HeroCardAttributes>().handrecovery1 = MatchControl.mcontrol.hero2.GetComponent<HeroCardAttributes>().cheatedrecovery1;
  199.                     MatchControl.mcontrol.hero2.GetComponent<HeroCardAttributes>().cheatedrecovery1 = 0;
  200.                     MatchControl.mcontrol.hero2.GetComponent<HeroCardAttributes>().handrecovery2 = MatchControl.mcontrol.hero2.GetComponent<HeroCardAttributes>().cheatedrecovery2;
  201.                     MatchControl.mcontrol.hero2.GetComponent<HeroCardAttributes>().cheatedrecovery2 = 0;
  202.  
  203.                     //na graftei kwdikas na katastrefetai to oplo edw
  204.                     //override,if it is twohanded slot 1 will be the weapon and slot 2 will be nulled regardless of what existed
  205.                 }
  206.  
  207.                 /*Refresh hand out of function
  208.                 MatchControl.mcontrol.player1cards[handslot] = null;
  209.                 if (handslot < 10)
  210.                 {
  211.                     for (int i = handslot; i < 9 && MatchControl.mcontrol.player1cards[i + 1] != null; i++)
  212.                     {
  213.                         MatchControl.mcontrol.player1cards[i] = MatchControl.mcontrol.player1cards[i + 1];
  214.                     }
  215.                     MatchControl.mcontrol.player1cards[9] = null;
  216.                 }
  217.                 else
  218.                 {
  219.                     for (int i = handslot; i < 19 && MatchControl.mcontrol.player1cards[i + 1] != null; i++)
  220.                     {
  221.                         MatchControl.mcontrol.player1cards[i] = MatchControl.mcontrol.player1cards[i + 1];
  222.                     }
  223.                     MatchControl.mcontrol.player1cards[19] = null;
  224.                 }*/
  225.                 //??MatchControl.mcontrol.hero1.GetComponent<HeroCardAttributes>().defence += weaponcard.GetComponent<WeaponCardAttributes>().defence;
  226.                 TriggerEvents(MatchControl.mcontrol.WeaponEquipped2EventEffects);//might need to invoke differently if i need to summon from deck/nowhere
  227.                 //battlecry?
  228.             }
  229.             else
  230.             {
  231.                 //show notification not enough mana?
  232.             }
  233.         }
  234.         return summon;
  235.     }
Advertisement
Add Comment
Please, Sign In to add comment