Exemple #1
0
 private Player()
 {
     this.Name = "Player";
     this.Progress = new GameProgress ();
     this.PurchasedItems = new List<BuyableItem> ();
     this.CurrentUsableItem = null;
     this.ProgressDictionary = new Dictionary<string, int> ();
 }
Exemple #2
0
    public static void AddUsableItem(UsableItem usableItem, MainWindowEditor Data)
    {
        //usableItem.Recharge = EditorUtils.FloatField(usableItem.Recharge ,"Cooldown");

        EditorGUILayout.Separator();
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.PrefixLabel("Cooldown type");

        //usableItem.UsageSkill = (UsageSkillType)EditorGUILayout.EnumPopup(usableItem.UsageSkill ,GUILayout.Width(300));
        EditorGUILayout.EndHorizontal();

        EditorUtils.Separator();
        EditorUtils.Label("Usable effects");

        //EffectUtils.EffectsEditor(usableItem.Effects, Data);

        //ConditionsUtils.Conditions(usableItem.UseConditions, Data);
    }
Exemple #3
0
    public void ApplyTGS(string item)
    {
        GameObject tgt = planetPointer.GetObjectPointedAt();

        if (tgt.GetComponent(typeof(Planter)))
        {
            UsableItem useItem = spaceBarn.TGSItemFromString(item);

            if (useItem.GetItemType() == "Plant")
            {
                //Debug.Log ("In plant branch");
                (tgt.GetComponent(typeof(Planter)) as Planter).PlantSeed(useItem as Plant);
                int seedCount = spaceBarn.RemovePlant(useItem as Plant);
                if (seedCount == 0)
                {
                    DisplayTGSMenu();
                }
            }
            else if (useItem.GetItemType() == "Goodie")
            {
                //Debug.Log ("In goodie branch");
                (tgt.GetComponent(typeof(Planter)) as Planter).ApplyGoodie(useItem as Goodie);
                int goodieCount = spaceBarn.RemoveGoodie(useItem as Goodie);
                if (goodieCount == 0)
                {
                    DisplayTGSMenu();
                }
            }
            else if (useItem.GetItemType() == "Tool")
            {
            }
        }
        else if (tgt.GetComponent(typeof(Planet)))
        {
            //TODO: Terraforming stuff here
        }
        else
        {
            //TODO: Put some default stuff here
        }
    }
Exemple #4
0
 // Update is called once per frame
 void Update()
 {
     //If you press the button associated with the hotkey slot
     if (Input.GetKeyDown(keyPress))
     {
         int id = hotkey.id;                                           //Get the id of the item or skill the player is going to use
         if (id != -1)                                                 //If there's actually something in the hotkey slot
         {
             if (hotkey.hotkeyType.Equals(Hotkey.HotkeyType.ITEM))     //If it's an item
             {
                 UsableItem item = (UsableItem)itemDB.GetItemByID(id); //Get the actual item
                 item.Action();                                        //Perform the action associated with the item
             }
             else //If it's a skill
             {
                 Skill skill = (Skill)skillDB.GetSkillByID(id); //Get the actual skill
                 skill.UseSkill();                              //Use the skill
             }
         }
     }
 }
Exemple #5
0
    private void InventoryRightClick(BaseItemSlot itemSlot)
    {
        if (itemSlot.Item is EquippableItem)
        {
            Equip((EquippableItem)itemSlot.Item);
            //uIHud.UpdateStatValues();
        }
        else if (itemSlot.Item is UsableItem)
        {
            UsableItem usableItem = (UsableItem)itemSlot.Item;
            usableItem.Use(this);
            statPanel.UpdateStatValues();

            if (usableItem.IsConsumable)
            {
                inventory.RemoveItem(usableItem);
                usableItem.Destroy();
                uIHud.UpdateStatValues();
            }
        }
    }
Exemple #6
0
 public bool AddItemToInventory(UsableItem newItem)
 {
     equipment.inventory.Add(newItem);
     //TODO: remove: (only for tests)
     if (equipment.fastAccess[0] == null)
     {
         EquipItemToFastAccess(0, newItem);
         return(true);
     }
     if (equipment.fastAccess[1] == null)
     {
         EquipItemToFastAccess(1, newItem);
         return(true);
     }
     if (equipment.fastAccess[2] == null)
     {
         EquipItemToFastAccess(2, newItem);
         return(true);
     }
     return(false);
 }
Exemple #7
0
        public void CmdUseItem(Vector2Byte position)
        {
            if (inventoryData.ContainsKey(position))
            {
                Item item = ObjectDatabase.GetItem(inventoryData[position].ID);
                if (item is UsableItem)
                {
                    UsableItem usableItem = (UsableItem)item;

                    Armor        += usableItem.ArmorBonus;
                    maxHealth    += usableItem.MaxHealthBonus;
                    Health       += usableItem.HealthBonus;
                    Strength     += usableItem.StrengthBonus;
                    Intelligence += usableItem.IntelligenceBonus;
                    Stamina      += usableItem.StaminaBonus;
                    // TODO: TIME BUFFS
                }

                RemoveItem(position, 1);
            }
        }
Exemple #8
0
        public void Config_SetResourceRequirements()
        {
            List <CraftingMap> defaultListRequirements = shopCraftingSystemBehaviour.system.craftingSubSubSystem.craftingRequirement;
            List <CraftingMap> newListRequirements     = new List <CraftingMap>();

            foreach (CraftingMap craftingMap in defaultListRequirements)
            {
                CraftingChoice newCraftingChoice = craftingMap.choice;

                UsableItem newResultingItem  = craftingMap.resource.resultingItem;
                float      newTimeToCreation = craftingMap.resource.timeToCreation;
                List <ResourceRequirement> newResourcesRequirements = new List <ResourceRequirement>();
                foreach (ResourceRequirement resourceRequirement in craftingMap.resource.resourcesRequirements)
                {
                    CraftingResources newType = resourceRequirement.type;
                    int newNumber             = UnityEngine.Random.Range(1, 10);
                    newResourcesRequirements.Add(new ResourceRequirement(newType, newNumber));
                }

                CraftingRequirements newCraftingRequirements = new CraftingRequirements
                {
                    resultingItem         = newResultingItem,
                    timeToCreation        = newTimeToCreation,
                    resourcesRequirements = newResourcesRequirements
                };

                CraftingMap newCraftingMap = new CraftingMap
                {
                    choice   = newCraftingChoice,
                    resource = newCraftingRequirements
                };

                newListRequirements.Add(newCraftingMap);
            }

            configSystem.SetResourceRequirements(newListRequirements);

            Assert.AreEqual(shopCraftingSystemBehaviour.system.craftingSubSubSystem.craftingRequirement, newListRequirements);
            Assert.AreNotEqual(defaultListRequirements, newListRequirements);
        }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            yield return(Toils_Reserve.Reserve(TargetIndex.A));

            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnDespawnedNullOrForbidden(TargetIndex.A).FailOnSomeonePhysicallyInteracting(TargetIndex.A));

            yield return(Toils_General.Wait(500).WithProgressBarToilDelay(TargetIndex.A).FailOnDestroyedNullOrForbidden(TargetIndex.A));

            yield return(new Toil()
            {
                initAction = delegate
                {
                    UsableItem item = TargetA.Thing as UsableItem;

                    if (item != null)
                    {
                        item.Use();
                    }
                },
                defaultCompleteMode = ToilCompleteMode.Instant
            });
        }
        public void SetUp()
        {
            herb             = new UsableItem();
            herb.Id          = 0;
            herb.Name        = "Herb";
            herb.Description = "A common herb";
            coin             = new UsableItem();
            coin.Id          = 1;
            coin.Name        = "Coin";
            coin.Description = "A gold coin";

            GameTime.Reset();
            player = new Player("John");
            enemy  = new Enemy("Zombie");
            enemy.Stats.Magic.Value = 30;
            passiveMagicSkill       = new PassiveMagicSkill(id: 0,
                                                            name: "ShadowStrength",
                                                            description: "A +10 Buff to the user's strength.",
                                                            cost: 10,
                                                            duration: 10,
                                                            cooldownTime: 5,
                                                            modifierValue: 10,
                                                            modifiedAttributeName: "Body",
                                                            itemSequence: new int[] { herb.Id });

            offensiveMagicSkill = new OffensiveMagicSkill(id: 1,
                                                          name: "Fireball",
                                                          description: "A ball of fire.",
                                                          cooldownTime: 5,
                                                          itemSequence: new int[] { herb.Id },
                                                          damage: 1,
                                                          maximumTargets: 2,
                                                          range: 2,
                                                          cost: 1);

            SkillDatabase.MagicSkills = new MagicSkill[] { passiveMagicSkill, offensiveMagicSkill };

            player.OnMagicSkillTriggered += MagicSkillTriggered;
        }
Exemple #11
0
        public void Inventory_RemoveItem()
        {
            //Reset inventory
            adventurerAgent.ResetEconomyAgent();

            List <BaseItemPrices> basePrices = agentShopSubSystem.basePrices;

            for (int i = 0; i < basePrices.Count; i++)
            {
                //Sword
                UsableItem itemToAdd = basePrices[i].item;

                //Add to the inventory
                adventurerAgent.inventory.AddItem(itemToAdd);

                //Remove from the inventory
                adventurerAgent.inventory.RemoveItem(itemToAdd);

                //Check if contains it
                Assert.False(adventurerAgent.inventory.ContainsItem(itemToAdd));
            }
        }
 //function that is called that instantiates all of the entities in the game
 private void BeginGame()
 {
     mazeInstance = Instantiate(mazePrefab) as Maze;
     //yield return StartCoroutine(mazeInstance.Generate()); //StartCoroutine starts an internal clock determins the time it takes to create the map
     mazeInstance.Generate();
     playerInstance = Instantiate(playerPrefab) as Player;
     playerInstance.SetLocation(mazeInstance.GetCell(mazeInstance.RandomCoordinates));
     for (int x = 0; x < numbBatteries; x++)
     {
         BatteriesInstance = Instantiate(BatteriesPreFab) as UsableItem;
         while (itemPlaced == false)
         {
             itemPlaced = BatteriesInstance.SetLocation(mazeInstance.GetCell(mazeInstance.RandomCoordinates));
         }
         itemPlaced = false;
     }
     GhostInstance = Instantiate(GhostPreFab) as GhostAi;
     while (ghostPlaced == false)
     {
         ghostPlaced = GhostInstance.SetLocation(mazeInstance.GetCell(mazeInstance.RandomCoordinates));
     }
 }
Exemple #13
0
 public void UseItem(int index)
 {
     // validate
     // note: checks durability only if it should be used (if max > 0)
     if (health.current > 0 &&
         0 <= index && index < slots.Count &&
         slots[index].amount > 0 &&
         slots[index].item.data is UsableItem)
     {
         // use item
         // note: we don't decrease amount / destroy in all cases because
         // some items may swap to other slots in .Use()
         UsableItem itemData = (UsableItem)slots[index].item.data;
         if (itemData.CanUse(this, index) == Usability.Usable)
         {
             // .Use might clear the slot, so we backup the Item first for the Rpc
             Item item = slots[index].item;
             itemData.Use(this, index);
             OnUsedItem(item);
         }
     }
 }
Exemple #14
0
    // note: lookAt is available in PlayerLook, but we still pass the exact
    // uncompressed Vector3 here, because it needs to be PRECISE when shooting,
    // building structures, etc.
    public void UseItem(int index, Vector3 lookAt)
    {
        // validate
        if (0 <= index && index < slots.Count &&
            health.current > 0)
        {
            // use item at index, or hands
            // note: we don't decrease amount / destroy in all cases because
            // some items may swap to other slots in .Use()
            UsableItem itemData = GetUsableItemOrHands(index);
            if (itemData.CanUse(this, index, lookAt) == Usability.Usable)
            {
                // use it
                itemData.Use(this, index, lookAt);

                // reset usage time
                usageEndTime = Time.time + itemData.cooldown;

                // RpcUsedItem needs itemData, but we can't send that as Rpc
                // -> we could send the Item at slots[index], but .data is null
                //    for hands because hands actually live in '.hands' variable
                // -> we could create a new Item(itemData) and send, but it's
                //    kinda odd that it's different from slot
                // => only sending hash saves A LOT of bandwidth over time since
                //    this rpc is called very frequently (each weapon shot etc.)
                //    (we reuse Item's hash generation for simplicity)
                OnUsedItem(itemData, lookAt);
            }
            else
            {
                // CanUse is checked locally before calling this Cmd, so if we
                // get here then either our prediction is off (in which case we
                // really should show a message for easier debugging), or someone
                // tried to cheat, or there's some networking issue, etc.
                Debug.LogWarning("UseItem rejected for: " + name + " item=" + itemData.name + "@" + Time.time);
            }
        }
    }
        public void Shop_SellSeveralRandomItems()
        {
            //Add between 5 to 10 items
            int randomItemNumber = UnityEngine.Random.Range(5, 10);

            for (int i = 0; i < randomItemNumber; i++)
            {
                CraftingChoice randomSword = listCraftingChoices[UnityEngine.Random.Range(0, listCraftingChoices.Count)];
                UsableItem     sword       = AddItemInInventory(shopAgent.agentInventory, randomSword);
                agentShopSubSystem.SubmitToShop(shopAgent, sword);
            }

            List <UsableItem> shop = agentShopSubSystem.GetShopItems(shopAgent);

            Assert.NotNull(shop, "Empty shop");
            AgentData aData = agentShopSubSystem.GetShop(shopAgent);

            Assert.NotNull(aData, "Empty AgentData");

            //Check the number of items in the shop
            int nbrSwords  = 0;
            int nbrSwords2 = 0;

            foreach (UsableItem item in shop)
            {
                nbrSwords2 += agentShopSubSystem.GetNumber(shopAgent, item.itemDetails);
                nbrSwords  += aData.GetStock(item);
            }
            Assert.AreEqual(randomItemNumber, nbrSwords, "Wrong stock in AgentData");
            Assert.AreEqual(randomItemNumber, nbrSwords2, "Wrong stock in AgentShopSubSystem");

            //Check price
            foreach (UsableItem item in shop)
            {
                int basePrice = GetPriceByItemName(item.itemDetails.itemName);
                Assert.AreEqual(basePrice, agentShopSubSystem.GetPrice(shopAgent, item.itemDetails));
            }
        }
Exemple #16
0
        public override bool Perform()
        {
            object[] objects = ((IBackPackBeing)performer).BackPack.Items.ToArray();
            if (objects.Length == 0)
            {
                return(false);
            }
            UsableItem item = (UsableItem)selectTarget(objects);

            if (item == null)
            {
                return(false);
            }
            if (item is Potion)
            {
                return(new DrinkAction(performer, item).Perform());
            }
            if (item is Scroll)
            {
                return(new ReadAction(performer, item).Perform());
            }
            return(true);
        }
    public override void ExecuteEffect(UsableItem parentItem, Player player)
    {
        switch (statType)
        {
        case StatType.Strength:
            StatModifier statModifier = new StatModifier(BuffAmount, StatModType.Flat, this);
            player.strength.AddModifier(statModifier);
            player.StartCoroutine(RemoveBuff(player, statModifier, Duration));
            break;

        case StatType.Dexterity:
            break;

        case StatType.Intelligence:
            break;

        case StatType.Vitality:
            break;

        default:
            break;
        }
    }
        public void Shop_SellOneItem()
        {
            CraftingChoice randomSword = listCraftingChoices[UnityEngine.Random.Range(0, listCraftingChoices.Count)];

            //Add sword to the inventory
            UsableItem sword = AddItemInInventory(shopAgent.agentInventory, randomSword);

            //Submit it into the shop
            agentShopSubSystem.SubmitToShop(shopAgent, sword);

            List <UsableItem> shop = agentShopSubSystem.GetShopItems(shopAgent);

            Assert.NotNull(shop, "Empty shop");

            //Check number
            Assert.AreEqual(1, shop.Count);
            Assert.AreEqual(1, agentShopSubSystem.GetNumber(shopAgent, sword.itemDetails));

            //check price
            int basePrice = GetPriceByItemName(sword.itemDetails.itemName);

            Assert.AreEqual(basePrice, agentShopSubSystem.GetPrice(shopAgent, sword.itemDetails));
        }
Exemple #19
0
    private void Awake()
    {
        if (instance != null)
        {
            Destroy(gameObject);
        }
        else
        {
            instance = this;
        }

        player             = GameObject.FindGameObjectWithTag("Player");
        animator           = player.GetComponent <Animator>();
        usableItemView     = transform.GetChild(0).Find("UsableItemView").gameObject;
        usableItemViewPort = usableItemView.transform.Find("UsableItemViewPort").gameObject;
        usableItemContent  = usableItemViewPort.transform.Find("UsableItemContent").gameObject;

        usableIndicator = new GameObject[usableItemContent.transform.childCount];
        for (int i = 0; i < usableIndicator.Length; i++)
        {
            usableIndicator[i] = usableItemContent.transform.GetChild(i).gameObject;
        }
    }
Exemple #20
0
        public void Config_SetItemsDefaultPrices()
        {
            List <BaseItemPrices> defaultPrices = agentShopSubSystem.basePrices;

            //Set a new random list of BaseItemPrices
            List <BaseItemPrices> newPrices = new List <BaseItemPrices>();

            for (int i = 0; i < defaultPrices.Count; i++)
            {
                UsableItem itemToModify = defaultPrices[i].item;
                int        newPrice     = UnityEngine.Random.Range(1, 200);

                newPrices.Add(new BaseItemPrices
                {
                    item  = itemToModify,
                    price = newPrice
                });
            }

            configSystem.SetItemsDefaultPrices(newPrices);
            Assert.AreNotEqual(agentShopSubSystem.basePrices, defaultPrices, "Default prices have not been set");
            Assert.AreEqual(agentShopSubSystem.basePrices, newPrices);
            Assert.AreNotEqual(defaultPrices, newPrices, "Randomly equal");
        }
Exemple #21
0
        public void Update()
        {
            var toRemove = new List <ShopAgent>();

            foreach (var agent in _shopAgents)
            {
                _shopRequests[agent].CraftingTime += Time.deltaTime;
                if (_shopRequests[agent].Complete)
                {
                    Debug.Log("Complete");
                    var generatedItem = UsableItem.GenerateItem(_shopRequests[agent].CraftingRequirements.resultingItem);
                    agent.agentInventory.AddItem(generatedItem);
                    OverviewVariables.CraftItem();

                    toRemove.Add(agent);
                }
            }

            foreach (var item in toRemove)
            {
                _shopRequests.Remove(item);
                _shopAgents.Remove(item);
            }
        }
Exemple #22
0
    public void AddUsable(UsableItem item)
    {
        //Sets a applying text to be active
        _usables.Add(item);

        switch (item.GetID())
        {
        case UsableID.MEDKIT:
            _applyingHealthText.SetActive(true);
            break;

        case UsableID.DAMAGE:
            _applyingDamageText.SetActive(true);
            break;

        case UsableID.RESISTANCE:
            _applyingResistanceText.SetActive(true);
            break;

        case UsableID.SPEED:
            _applyingSpeedText.SetActive(true);
            break;
        }
    }
Exemple #23
0
 public abstract void ExecuteEffect(UsableItem parentItem, Unit unit);
Exemple #24
0
 public override void ExecuteEffect(UsableItem parentItem, Player player)
 {
     player.combat.ExecuteRelicEffect(RelicType.Fang);
 }
Exemple #25
0
	public static void AddUsableItem(UsableItem usableItem, MainWindowEditor Data)
	{
		
		//usableItem.Recharge = EditorUtils.FloatField(usableItem.Recharge ,"Cooldown");
		
		EditorGUILayout.Separator();
		EditorUtils.Label("Usable effects");
		
		//EffectUtils.EffectsEditor(usableItem.Effects, Data);
		
		//ConditionsUtils.Conditions(usableItem.UseConditions, Data);
	}
 void OnDrop(GameObject dropper)
 {
     heldItem   = null;
     usableItem = null;
 }
    // Update is called once per frame
    void Update()
    {
        Vector2 input      = GetMovementInput();
        Vector2 mouseInput = GetMouseInput();
        float   rollInput  = GetRotationInput();
        float   vInput     = GetVerticalInput();

        Quaternion lookX    = Quaternion.AngleAxis(mouseInput.x, Vector3.up);
        Quaternion lookY    = Quaternion.AngleAxis(mouseInput.y, -Vector3.right);
        Quaternion lookRoll = Quaternion.AngleAxis(rollInput, -Vector3.forward);

        transform.localRotation = transform.localRotation * lookX * lookY * lookRoll;

        Vector3 move = (transform.forward * input.y) + (transform.right * input.x) + (transform.up * vInput);

        rb.velocity = move * Speed;

        GameObject objectInCrosshairs = GetObjectInCrosshairs();

        if (objectInCrosshairs != target)
        {
            if (target != null)
            {
                target.GetComponent <Outline>().enabled = false;
                target = null;
            }

            if (objectInCrosshairs != null)
            {
                objectInCrosshairs.GetComponent <Outline>().enabled = true;
                target = objectInCrosshairs;
            }
        }


        if (Input.GetMouseButtonDown(0))
        {
            if (heldItem == null)
            {
                if (objectInCrosshairs != null)
                {
                    HoldableItem holdable = objectInCrosshairs.GetComponent <HoldableItem>();
                    if (holdable)
                    {
                        holdable.PickUp(Hand);
                        heldItem           = holdable;
                        heldItem.OnThrown += OnDrop;
                        usableItem         = heldItem.GetComponent <UsableItem>();
                    }
                    else
                    {
                        UsableItem usable = objectInCrosshairs.GetComponent <UsableItem>();
                        if (usable)
                        {
                            usable.Use(gameObject, objectInCrosshairs);
                        }
                    }
                }
            }
            else
            {
                if (usableItem)
                {
                    usableItem.Use(gameObject, objectInCrosshairs);
                }
            }
        }

        if (heldItem != null && Input.GetMouseButtonDown(1))
        {
            heldItem.Drop(Hand);
            heldItem = null;
        }
    }
        public void PlayerItemStart(UsableItem selectedItem)
        {
            if (uiState == UIStateType.PlayerDecide)
            {
                clickPoint = null;
                this.selectedItem = selectedItem;
                playerDecideState = PlayerDecideState.ItemPendingClick;

                UpdateUI();
            }
        }
 public override void ExecuteEffect(UsableItem parentItem, Unit unit)
 {
     unit.stats[StatString.MANA].AddModifier(new StatModifier(regenAmount, StatModType.PercentAdd));
 }
Exemple #30
0
 public override void ExecuteEffect(UsableItem usableItem, Character character)
 {
     character.Health += HealAmount;
 }
Exemple #31
0
    void Start()
    {
        pistols = Resources.LoadAll("Sprites/pistols");
        //weapons
        pistols = Resources.LoadAll("Sprites/pistols");
        Weapon EmptyWeapon = new Weapon(0, "Empty", 0, 0, null, 0, 0, 0, 0, 0, null, null, new Vector2(0, 0), 0f, 0f, null, null);

        Weapons.Add(EmptyWeapon);
        Weapon glock17 = new Weapon(1, "Glock 17", 0.0f, 50f, Resources.Load <Sprite>("Sprites/glock"), 0.35f, 0.25f, 25f, Mathf.Infinity, 17, Resources.Load("Prefabs/glock bullet") as GameObject, Resources.Load("Sounds/glock17") as AudioClip, new Vector2(-0.028f, 0.604f), 2f, -2f, Resources.Load("Sounds/reload") as AudioClip, (Sprite)pistols[1]);

        Weapons.Add(glock17);
        Weapon DEagle = new Weapon(2, "Desert Eagle", 40f, 150f, Resources.Load <Sprite>("Sprites/de"), 0.4f, 1f, 1f, 100f, 9, Resources.Load("Prefabs/glock bullet") as GameObject, Resources.Load("Sounds/de") as AudioClip, new Vector2(-0.028f, 0.604f), 6f, -6f, Resources.Load("Sounds/deagle_reload") as AudioClip, (Sprite)pistols[2]);

        Weapons.Add(DEagle);
        Weapon Kalashnikov = new Weapon(3, "AK 47", 100f, 350f, Resources.Load <Sprite>("Sprites/AK47"), 0.42f, 0.1f, 50f, 250, 30, Resources.Load("Prefabs/glock bullet") as GameObject, Resources.Load("Sounds/ak47") as AudioClip, new Vector2(0.056f, 0.562f), 5f, -5f, Resources.Load("Sounds/AK47_reload") as AudioClip, Resources.Load <Sprite>("Sprites/ak48"));

        Weapons.Add(Kalashnikov);
        Weapon Barrett = new Weapon(4, "Barrett M82", 350f, 800f, Resources.Load <Sprite>("Sprites/barett"), 1f, 1.5f, 200f, 50, 5, Resources.Load("Prefabs/Barrett bullet") as GameObject, Resources.Load("Sounds/barrett") as AudioClip, new Vector2(0.06f, 0.65f), 0f, 0f, Resources.Load("Sounds/reload") as AudioClip, Resources.Load <Sprite>("Sprites/barrett"));

        Weapons.Add(Barrett);
        Weapon M416 = new Weapon(5, "M416", 200f, 400f, Resources.Load <Sprite>("Sprites/M416"), 0.55f, 0.086f, 40f, 150, 30, Resources.Load("Prefabs/glock bullet") as GameObject, Resources.Load("Sounds/m416") as AudioClip, new Vector2(0.056f, 0.562f), 3f, -3f, Resources.Load("Sounds/m4_reload") as AudioClip, Resources.Load <Sprite>("Sprites/m417"));

        Weapons.Add(M416);
        Weapon AUG = new Weapon(6, "AUG", 300f, 600f, Resources.Load <Sprite>("Sprites/AUG"), 0.55f, 0.086f, 42f, 150, 40, Resources.Load("Prefabs/glock bullet") as GameObject, Resources.Load("Sounds/aug") as AudioClip, new Vector2(0.056f, 0.562f), 1f, -1f, Resources.Load("Sounds/aug_reload") as AudioClip, Resources.Load <Sprite>("Sprites/aug 1"));

        Weapons.Add(AUG);
        Weapon SW17 = new Weapon(7, "S&W Model 17", 20f, 50f, Resources.Load <Sprite>("Sprites/SW17"), 0.4f, 0.7f, 20f, 100, 6, Resources.Load("Prefabs/glock bullet") as GameObject, Resources.Load("Sounds/sw17_sound") as AudioClip, new Vector2(-0.028f, 0.604f), 1f, -1f, Resources.Load("Sounds/sw17_reload") as AudioClip, (Sprite)pistols[3]);

        Weapons.Add(SW17);
        Weapon P90 = new Weapon(8, "P90", 200f, 500f, Resources.Load <Sprite>("Sprites/P90"), 0.4f, 0.067f, 30f, 180, 50, Resources.Load("Prefabs/glock bullet") as GameObject, Resources.Load("Sounds/p90_sound") as AudioClip, new Vector2(0.056f, 0.432f), 1f, -1f, Resources.Load("Sounds/p90_reload") as AudioClip, Resources.Load <Sprite>("Sprites/p91"));

        Weapons.Add(P90);
        Weapon SawedOff = new Weapon(9, "Sawed-off", 100, 250, Resources.Load <Sprite>("Sprites/sawed-off"), 0.25f, 0.8f, 20f, 50, 2, Resources.Load("Prefabs/shotgun bullet") as GameObject, Resources.Load("Sounds/sawed-off shot") as AudioClip, new Vector2(0.056f, 0.432f), 8, -8, Resources.Load("Sounds/sawed-off reload") as AudioClip, Resources.Load <Sprite>("Sprites/sawed-off1"));

        Weapons.Add(SawedOff);
        //items
        Passive nullpasive = new Passive(0, "Ass", Mathf.Infinity, 0, null);

        Passives.Add(nullpasive);
        AnotherHeart ah = new AnotherHeart(1, "AnotherHeart", 75, 125, Resources.Load <Sprite>("Sprites/HeartUp"));

        Passives.Add(ah);
        //bonusese
        bonus      zerobonus = new bonus(0, "ASs", 0, 0, null);
        RefillAmmo ammorefil = new RefillAmmo(1, "Ammo Refill", 0, 50, Resources.Load <Sprite>("Sprites/Ammorefil"));
        RefillHP   refillhp  = new RefillHP(2, "HP refill", 0, 75, Resources.Load <Sprite>("Sprites/fullhealth"));

        Bonuses.Add(zerobonus);
        Bonuses.Add(ammorefil);
        Bonuses.Add(refillhp);
        //actives
        UsableItem        nullusable = new UsableItem(0, "ASs", 0, 0, null, 0);
        airstrike         airstrike  = new airstrike(1, "Airstrike", 40, 120, Resources.Load <Sprite>("Sprites/airstrike"), 25);
        PortableBloodBank pbb        = new PortableBloodBank(2, "Portable blood bank", 25, 100, Resources.Load <Sprite>("Sprites/Piggy empty"), 0.1f);
        ammodrop          ad         = new ammodrop(3, "Ammo Delivery", 50, 200, Resources.Load <Sprite>("Sprites/ammodrop"), 25f);

        Usables.Add(nullusable);
        Usables.Add(airstrike);
        Usables.Add(pbb);
        Usables.Add(ad);
    }
Exemple #32
0
 public override void ExecuteEffect(UsableItem parentItem, Player player)
 {
     player.spellbook.Infernal.Summon(player);
 }
        private void DisplayHighlightTilesForItem(UsableItem item)
        {
            Point fixedHoverPoint = new Point(hoverPoint.x, -hoverPoint.y);
            Tile origin;
            Tile dest;
            List<Point> pointList = new List<Point>();

            if (item.itemAbility != null)
            {


                switch (item.itemAbility.targetType)
                {
                    case AbilityTargetType.AllFoes:
                        break;
                    case AbilityTargetType.AllFriends:
                        break;
                    case AbilityTargetType.LOSEmpty:
                        origin = battleGame.board.getTileFromLocation(battleGame.ActiveCharacter.x, battleGame.ActiveCharacter.y);
                        dest = battleGame.board.getTileFromPoint(fixedHoverPoint);
                        pointList = battleGame.board.getBoardLOSPointList(origin, dest);
                        if (battleGame.board.checkLOS(origin, dest) && pointList.Count <= item.itemAbility.range && item.actionPoints <= battleGame.ActiveCharacter.ap)
                        {
                            AddHighlightTiles(pointList, Color.green);
                        }
                        else { AddHighlightTiles(pointList, Color.red); }
                        break;
                    case AbilityTargetType.LOSTarget:
                        //Also need to make sure destination is a game character
                        origin = battleGame.board.getTileFromLocation(battleGame.ActiveCharacter.x, battleGame.ActiveCharacter.y);
                        dest = battleGame.board.getTileFromPoint(fixedHoverPoint);
                        pointList = battleGame.board.getBoardLOSPointList(origin, dest);
                        if (battleGame.board.checkLOS(origin, dest) && pointList.Count <= item.itemAbility.range && item.actionPoints <= battleGame.ActiveCharacter.ap)
                        {
                            AddHighlightTiles(pointList, Color.green);
                        }
                        else { AddHighlightTiles(pointList, Color.red); }
                        break;

                    case AbilityTargetType.PointEmpty:
                        pointList.Add(fixedHoverPoint);
                        AddHighlightTiles(pointList, Color.green);
                        break;
                    case AbilityTargetType.PointTarget:
                        //verify target is character
                        pointList.Add(fixedHoverPoint);
                        AddHighlightTiles(pointList, Color.green);
                        break;
                    case AbilityTargetType.Self:
                        break;
                    case AbilityTargetType.SingleFoe:
                        break;
                    case AbilityTargetType.SingleFriend:
                        break;
                    default: break;
                }
            }

        }
Exemple #34
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Usable"/> class.
 /// </summary>
 /// <param name="itemBase">The base <see cref="UsableItem"/> class.</param>
 public Usable(UsableItem itemBase)
     : base(itemBase)
 {
     Base = itemBase;
 }
 public ItemFactoryData(UsableItem item)
 {
     ItemName      = item.ItemName;
     this.quantity = item.Quantity;
 }
	public static void AddUsableItemsToInventory(int pmPlayerId, Dictionary<string,Item> pmInventory, Player player)
	{
		IDbConnection dbconn = GetConnection ();
		IDbCommand dbcmd = dbconn.CreateCommand();
		string sqlQuery = "select ui.NAME, ui.DESCRIPTION, ui.EFFECT_TYPE, ui.DIECE_NUMBER, ui.DIECE_VALUE, ui.STATIC_VALUE, ui.TARGETS_NUMBER, ui.TARGETS_TYPE, ui.RANGE, ui.EFFECT_SHAPE, ui.EFFECT_SHAPE_SIZE, ui.ICON_NAME, es.NAME, ui.CAN_BE_SHORTCUT " +
			" from usable_items ui join CHARACTERS_ITEMS ci on ci.ITEM_ID = ui.ID  and ci.ITEM_TYPE = 3 JOIN EQUIPEMENT_SLOTS es on ci.FIELD_ID = es.ID where ci.CHARACTER_ID = " + pmPlayerId;	
		dbcmd.CommandText = sqlQuery;

		IDataReader reader = dbcmd.ExecuteReader();
		while (reader.Read ()) {

			List<EquipementTypes> types = new List<EquipementTypes> ();
			types.Add (EquipementTypes.ANY);

			Debug.Log ("AAAA" + reader.GetString (0));
			Debug.Log ("BBBB" + reader.GetInt32 (3));
			Debug.Log ("CCCC" + reader.GetInt32 (4));
			Debug.Log ("DDDD" + reader.GetInt32 (5));
			Debug.Log ("EEEE" + reader.GetInt32 (2));

			SelfEffect effect = new SelfEffect (reader.GetString (0),
				                    null,
				                    reader.GetInt32 (3),
				                    reader.GetInt32 (4),
				                    reader.GetInt32 (5),
				                    reader.GetInt32 (2)
			                    );

			Item lvItem = new UsableItem (reader.GetString (0), reader.GetString (1), types, effect);  
			lvItem.resourceImageName = reader.GetString (11);
			lvItem.inventoryFieldId = reader.GetString (12);


			pmInventory.Add (reader.GetString (12), lvItem);
		}

		CleanUp (reader,dbcmd,dbconn);
		reader = null;
		dbcmd = null;
		dbconn = null;
	}