コード例 #1
0
    public override void InventoryEventOnLevelExit()
    {
        if (_RES == GAME_UW2)
        {
            return;
        }                                   //UW2 stores enchantments on the player.dat. This is not implemented yet
        //Store the spell properties so I can create it in the next level.
        base.InventoryEventOnLevelExit();
        GameObject linked = ObjectLoader.getGameObjectAt(objInt().link);

        if (linked != null)
        {
            a_spell spell = linked.GetComponent <a_spell>();
            if (spell != null)
            {
                SpellObjectOwnerToCreate   = spell.objInt().owner;
                SpellObjectQualityToCreate = spell.objInt().quality;
                //SpellObjectLinkToCreate=spell.objInt().link;
                //Flag the spell trap as not being in use and change it's type to a fist so it will not persist.
                //Assumes spell traps are all stored off map
                spell.objInt().objectloaderinfo.InUseFlag = 0;
                spell.objInt().objectloaderinfo.item_id = 0;
            }
        }
        //SpellObjectOwnerToCreate
    }
コード例 #2
0
 public override void MoveToInventoryEvent()
 {
     if (enchantment == 0)
     {        //Object links to a spell object
         if (linkedspell != null)
         {
             GameObject clonelinkedspell = Object.Instantiate(linkedspell.gameObject);
             clonelinkedspell.name = ObjectInteraction.UniqueObjectName(clonelinkedspell.GetComponent <ObjectInteraction>());
             clonelinkedspell.gameObject.transform.parent = GameWorldController.instance.InventoryMarker.transform;
             linkedspell = clonelinkedspell.GetComponent <a_spell>();
             //COpy data from original to new
             ObjectInteraction.CopyStaticProperties(linkedspell.objInt(), clonelinkedspell.GetComponent <ObjectInteraction>());
         }
     }
 }
コード例 #3
0
    //protected override void Start ()
    //{
    //	base.Start ();

    /*
     *          if (_RES==GAME_UW2)
     *          {
     *                  if (SpellObjectOwnerToCreate==-1)
     *                  {//This is  wand with infinite charges. Does not use a spell object for it's enchantment.
     * //Debug.Log("linking wand " + this.name + " to an existing spell");
     * //SpellObjectLink = ObjectLoader.getObjectIntAt(objInt().link).link;
     *                  }
     *                  else
     *                  {
     * if(objInt().PickedUp)
     * {//A wand and spell in the inventory loaded from a playerdat file. Need to create it's spell object now
     *      ObjectLoaderInfo newobjt= ObjectLoader.newObject(288, SpellObjectQualityToCreate,SpellObjectOwnerToCreate, SpellObjectLink, 256);
     *      ObjectInteraction spell = ObjectInteraction.CreateNewObject(GameWorldController.instance.currentTileMap(),newobjt,  GameWorldController.instance.DynamicObjectMarker().gameObject, GameWorldController.instance.DynamicObjectMarker().position );
     *      objInt().link = newobjt.index;
     * }
     *                  }
     *          }//UW2 stores enchantments on the player.dat. This is not properly implemented yet
     *
     *          if (! objInt().isEnchanted())
     *          {
     * if (ObjectLoader.getObjectIntAt(objInt().link)!=null)
     * {
     *              SpellObjectLink=ObjectLoader.getObjectIntAt(objInt().link).link;
     * }
     *          }
     *          else
     *          {
     *                  SpellObjectLink=0;
     *          }
     *
     *          SetDisplayEnchantment();
     *          ActualSpell=GetActualSpellIndex();
     */
//	}

    /// <summary>
    /// Gets the actual spell index of the spell.
    /// </summary>
    /// <returns>The actual spell index.</returns>
    /// Wands use link to a spell object to get their spell
    ///
    ///

    /* Per uwspecs
     * Most objects seem to use spells 256-320 (add 256) if the enchantment
     * number is in the range 0-63, otherwise they add 144 to use spells 208 and
     * up. Healing fountains, however, don't use a correction at all.
     */
    protected override int GetActualSpellIndex()
    {
        if (linkedspell != null)
        {
            return(linkedspell.objInt().link - 256);
        }
        else
        {
            if (_RES != GAME_UW2)
            {
                switch (objInt().link)
                {
                //TODO:Figure out the range here!

                case 579:                                                //frog
                case 580:                                                //maze
                case 581:                                                //hallucination
                    return(objInt().link - 368);

                default:
                    return(objInt().link - 256);
                }
            }
            else
            {                                    //TODO:Figure out the range here!
                switch (objInt().link)
                {
                case 576:                                                //altara
                    return(objInt().link - 368);

                default:
                    return(objInt().link - 256);
                }
            }
            //	return objInt().link-256;//Confirm mappings for UW2
        }

        /*
         *      if (objInt().isEnchanted()==true)
         *      {
         * if (objInt().link-512<63)
         * {
         *      return objInt().link-512+256;
         * }
         * else
         * {
         *      return objInt().link-512+144;
         * }
         *      }
         *      else
         *      {
         * if (_RES==GAME_UW2)
         * {
         * if (SpellObjectLink-256>=320)
         * {
         *      return SpellObjectLink-368;
         * }
         * }
         *
         * return SpellObjectLink-256;	//default
         *
         *      }*/
    }