示例#1
0
    public GameItem GetItemFromFormula(AlchemicalFormula formula)
    {
        double totalValue = (formula.InputMetal.AlchemyInfo.QueplarValue * formula.LocationMultiplier) +
                            (formula.Element.AlchemyInfo.QueplarValue * formula.ActionMultiplier);

        foreach (GameItem i in Items)
        {
            if (i.AlchemyInfo != null && i.Category == "Bars")
            {
                if (i.AlchemyInfo.QueplarValue == totalValue)
                {
                    return(i);
                }
            }
        }
        foreach (GameItem i in Items)
        {
            if (i.AlchemyInfo != null)
            {
                if (i.AlchemyInfo.QueplarValue == totalValue)
                {
                    return(i);
                }
            }
        }
        return(Items.Find(x => x.Name == "Alchemical Dust"));
    }
示例#2
0
 private void AlchItem()
 {
     if (AlchemyStage == 0)
     {
         if (Player.Instance.Inventory.HasItem(CurrentAlchemyFormula.InputMetal))
         {
             Player.Instance.Inventory.RemoveItems(CurrentAlchemyFormula.InputMetal, 1);
             AlchemyStage      = 1;
             TicksToNextAction = 10;
             MessageManager.AddMessage("You place the " + CurrentAlchemyFormula.InputMetal.Name + " into the pool.");
         }
         else
         {
             MessageManager.AddMessage("You don't have any " + CurrentAlchemyFormula.InputMetal.Name + ".");
             CurrentAlchemyFormula = null;
             AlchemyStage          = 0;
         }
     }
     else if (AlchemyStage == 1)
     {
         if (Player.Instance.Inventory.HasItem(CurrentAlchemyFormula.Element))
         {
             Player.Instance.Inventory.RemoveItems(CurrentAlchemyFormula.Element, 1);
             AlchemyStage      = 2;
             TicksToNextAction = 10;
             MessageManager.AddMessage("You apply the " + CurrentAlchemyFormula.Element.Name + " to the metal mixture in the pool.");
         }
         else
         {
             MessageManager.AddMessage("You don't have any " + CurrentAlchemyFormula.Element.Name + ".");
             CurrentAlchemyFormula = null;
             AlchemyStage          = 0;
         }
     }
     else if (AlchemyStage == 2)
     {
         MessageManager.AddMessage("You " + CurrentAlchemyFormula.ActionString + " the combined element and metal.");
         AlchemyStage      = 3;
         TicksToNextAction = 10;
     }
     else if (AlchemyStage == 3)
     {
         GameItem reward = ItemManager.Instance.GetItemFromFormula(CurrentAlchemyFormula);
         MessageManager.AddMessage("You withdraw the " + reward.Name + " from the release valve.");
         Player.Instance.Inventory.AddItem(reward);
         AlchemyStage      = 0;
         TicksToNextAction = 10;
     }
 }
示例#3
0
 private void ClearActions()
 {
     CurrentGatherItem     = null;
     RequiredForGatherItem = null;
     CurrentRecipe         = null;
     BattleManager.Instance.CurrentOpponents.Clear();
     CurrentSmithingRecipe         = null;
     CurrentAlchemyFormula         = null;
     AlchemyStage                  = 0;
     SmithingManager.SmithingStage = 0;
     CurrentSmeltingRecipe         = null;
     CurrentBook        = null;
     stopActions        = false;
     IsStoppingNextTick = false;
     if (NewGatherItem != null)
     {
         CurrentGatherItem = NewGatherItem;
         NewGatherItem     = null;
     }
     if (NewRequiredItem != null)
     {
         RequiredForGatherItem = NewRequiredItem;
         NewRequiredItem       = null;
     }
     if (NewSmithingRecipe != null)
     {
         CurrentSmithingRecipe = NewSmithingRecipe;
         NewSmithingRecipe     = null;
     }
     if (NewSmeltingRecipe != null)
     {
         CurrentSmeltingRecipe = NewSmeltingRecipe;
         NewSmeltingRecipe     = null;
     }
     if (NewCraftingRecipe != null)
     {
         CurrentRecipe     = NewCraftingRecipe;
         NewCraftingRecipe = null;
     }
     if (NewBook != null)
     {
         CurrentBook = NewBook;
         NewBook     = null;
     }
 }
示例#4
0
    public GameItem GetItemFromFormula(AlchemicalFormula formula)
    {
        double baseValue      = formula.InputMetal.AlchemyInfo.QueplarValue * formula.LocationMultiplier;
        double elementalValue = formula.Element.AlchemyInfo.QueplarValue * formula.ActionMultiplier;
        double totalValue     = baseValue + elementalValue;

        foreach (GameItem i in Items)
        {
            if (i.AlchemyInfo != null && i.SmithingInfo != null)
            {
                if (i.AlchemyInfo.QueplarValue == totalValue)
                {
                    return(i);
                }
            }
        }
        return(Items.Find(x => x.Name == "Alchemical Dust"));
    }
示例#5
0
        public int ReadFormula( AlchemicalFormula formula )
        {
            m_Name = formula.PotionName;
            m_Type = formula.PotionType;
            m_Bottle = formula.Bottle;
            Array.Copy( formula.IngredientTypes, m_IngredientTypes, m_IngredientTypes.Length );

            for ( int i=0; i<m_IngredientTypes.Length; i++ )
            {
                if ( m_IngredientTypes[i] == null )
                    continue;

                Item instance = (Item)Activator.CreateInstance(m_IngredientTypes[i]); // saves us some space
                if (!(instance is IAlchemyIngredient))
                    return -2;

                IAlchemyIngredient alchemyingredient = instance as IAlchemyIngredient;

                switch ( (int)m_Type )
                {
                    case (int)PotionType.Drink:
                    {
                        if ( !(instance is IDrinkIngredient) || !((IDrinkIngredient)instance).CanUse( m_Brewer ))
                            return -1; // don't know how to use that ingredient
                        break;
                    }

                    case (int)PotionType.Bomb:
                    {
                        if ( !(instance is IBombIngredient) || !((IBombIngredient)instance).CanUse( m_Brewer ))
                            return -1; // don't know how to use that ingredient
                        break;
                    }

                    case (int)PotionType.Oil:
                    {
                        if ( !(instance is IOilIngredient) || !((IOilIngredient)instance).CanUse( m_Brewer ))
                            return -1; // don't know how to use that ingredient
                        break;
                    }
                }

                m_IngredientPictures[i] = instance.ItemID;
                m_IngredientHues[i] = instance.Hue;
                AddIngredient( m_IngredientTypes[i], true ); // skip update
            }

            UpdateEffects();
            return 1; // success
        }