consumeObject() 공개 메소드

public consumeObject ( ) : void
리턴 void
 public override bool ActivateByObject(ObjectInteraction ObjectUsed)
 {
     //ObjectInteraction objI=ObjectUsed.GetComponent<ObjectInteraction>();
     if (ObjectUsed != null)
     {
         if (ObjectUsed.GetItemType() == ObjectInteraction.A_BLACKROCK_GEM)
         {
             if (ObjectUsed.owner == 1)
             {
                 int thisGemIndex = ObjectUsed.item_id - 280;
                 int bitField     = (1 << thisGemIndex);
                 Quest.instance.x_clocks[2]++;
                 Quest.instance.QuestVariables[130] |= bitField;
                 UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 338));
                 UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 338 + Quest.instance.x_clocks[2]));
                 CameraShake.instance.ShakeEarthQuake(Quest.instance.x_clocks[2] * 0.2f);
                 ObjectUsed.consumeObject();
             }
             else
             {
                 UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 347));
             }
             CurrentObjectInHand = null;
             return(true);
         }
     }
     return(false);
 }
    public override bool ActivateByObject(GameObject ObjectUsed)
    {
        ObjectInteraction objI = ObjectUsed.GetComponent <ObjectInteraction>();

        if (objI != null)
        {
            if (objI.GetItemType() == ObjectInteraction.A_BLACKROCK_GEM)
            {
                if (objI.owner == 1)
                {
                    int thisGemIndex = objI.item_id - 280;
                    int bitField     = (1 << thisGemIndex);
                    Quest.instance.x_clocks[2]++;
                    Quest.instance.QuestVariables[130] |= bitField;
                    UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 338));
                    UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 338 + Quest.instance.x_clocks[2]));
                    objI.consumeObject();
                }
                else
                {
                    UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 347));
                }
                UWCharacter.Instance.playerInventory.ObjectInHand = "";
                return(true);
            }
        }
        return(false);
    }
예제 #3
0
    public override bool ActivateByObject(GameObject ObjectUsed)
    {
        ObjectInteraction objIntUsed = ObjectUsed.GetComponent <ObjectInteraction>();

        if (GraveID == 6)
        {                                  //Garamon's grave
            //Activates a trigger a_move_trigger_54_52_04_0495 (selected by unknown means)
            if (objIntUsed.item_id == 198) //Bones
            {
                if (objIntUsed.Quality == 63)
                {                        //Garamons bones
                    //Arise Garamon.
                    //000~001~134~You thoughtfully give the bones a final resting place.
                    ml.Add(playerUW.StringControl.GetString(1, 134));
                    GameObject trig = GameObject.Find("a_move_trigger_54_52_04_0495");
                    if (trig != null)
                    {
                        objInt.Link++;                                //Update the grave description
                        objIntUsed.consumeObject();
                        trig.GetComponent <ObjectInteraction>().GetComponent <trigger_base>().Activate();
                    }
                    playerUW.CursorIcon = playerUW.CursorIconDefault;
                    playerUW.playerInventory.ObjectInHand = "";
                    return(true);
                }
                else
                {                        //Regular bones
                    //000~001~259~The bones do not seem at rest in the grave, and you take them back.
                    ml.Add(playerUW.StringControl.GetString(1, 259));
                    playerUW.CursorIcon = playerUW.CursorIconDefault;
                    playerUW.playerInventory.ObjectInHand = "";
                    return(true);
                }
            }
            else
            {
                return(ObjectUsed.GetComponent <ObjectInteraction>().FailMessage());
            }
        }
        else
        {
            if ((objIntUsed.item_id == 198) && (objIntUsed.Quality == 63))        //Garamons Bones used on the wrong grave
            {
                //000~001~259~The bones do not seem at rest in the grave, and you take them back.
                ml.Add(playerUW.StringControl.GetString(1, 259));
                playerUW.CursorIcon = playerUW.CursorIconDefault;
                playerUW.playerInventory.ObjectInHand = "";
                return(true);
            }
            else
            {
                playerUW.CursorIcon = playerUW.CursorIconDefault;
                playerUW.playerInventory.ObjectInHand = "";
                return(ObjectUsed.GetComponent <ObjectInteraction>().FailMessage());
            }
        }
    }
예제 #4
0
    public static void DestroyOrb(ObjectInteraction orbToDestroy)
    {
        //Spawn an impact
        Impact.SpawnHitImpact(Impact.ImpactDamage(), orbToDestroy.GetImpactPoint(), 46, 50);
        Quest.instance.isOrbDestroyed            = true;
        UWCharacter.Instance.PlayerMagic.MaxMana = UWCharacter.Instance.PlayerMagic.TrueMaxMana;
        UWCharacter.Instance.PlayerMagic.CurMana = UWCharacter.Instance.PlayerMagic.MaxMana;
        //000-001-133 The orb is destroyed
        UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 133));

        orbToDestroy.consumeObject();
    }
예제 #5
0
 private static void BreakLockPick(ObjectInteraction ObjectUsed)
 {
     //pick break
     if (_RES == GAME_UW2)
     {
         UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 134));
     }
     else
     {
         UWHUD.instance.MessageScroll.Add("You broke your pick. \n"); //string is hard coded in uw1??
     }
     ObjectUsed.consumeObject();
 }
 public override void ExecuteTrap(object_base src, int triggerX, int triggerY, int State)
 {
     //Test the crystals and delganiser
     if (
         (TestObjectAtTile(59, 4, 161, 2) != -1)
         &&
         (TestObjectAtTile(57, 4, 161, 6) != -1)
         &&
         (TestObjectAtTile(58, 4, 174, -1) != -1)
         )
     {
         //Once all conditions are met execute the following trap to spawn the  bliy
         ObjectInteraction obj = ObjectLoader.getObjectIntAt(642);
         if (obj != null)
         {
             if (obj.GetComponent <trigger_base>() != null)
             {
                 skupSpawned = true;
                 Quest.instance.QuestVariables[38]  = 1;
                 Quest.instance.QuestVariables[122] = 0;
                 obj.GetComponent <trigger_base>().Activate(this.gameObject);
                 int ObjToDestroy = TestObjectAtTile(59, 4, 161, 2);
                 if (ObjToDestroy != -1)
                 {
                     ObjectInteraction objToDestroy = ObjectLoader.getObjectIntAt(ObjToDestroy);
                     if (objToDestroy != null)
                     {
                         objToDestroy.consumeObject();
                     }
                 }
                 ObjToDestroy = TestObjectAtTile(57, 4, 161, 6);
                 if (ObjToDestroy != -1)
                 {
                     ObjectInteraction objToDestroy = ObjectLoader.getObjectIntAt(ObjToDestroy);
                     if (objToDestroy != null)
                     {
                         objToDestroy.consumeObject();
                     }
                 }
             }
         }
     }
 }
예제 #7
0
    //A lantern needs oil to work

    public override bool ActivateByObject(GameObject ObjectUsed)
    {
        ObjectInteraction objIntUsed = ObjectUsed.GetComponent <ObjectInteraction>();

        if (objIntUsed != null)
        {
            switch (objIntUsed.ItemType)
            {
            case ObjectInteraction.OIL:
                if (IsOn == true)
                {
                    ml.Add(playerUW.StringControl.GetString(1, 178));
                }
                else
                {
                    if (objInt.Quality == 64)
                    {
                        ml.Add(playerUW.StringControl.GetString(1, 180));
                    }
                    else
                    {
                        ml.Add(playerUW.StringControl.GetString(1, 179));
                        objInt.Quality = 64;
                        objIntUsed.consumeObject();
                    }
                }
                playerUW.CursorIcon = playerUW.CursorIconDefault;
                playerUW.playerInventory.ObjectInHand = "";
                return(true);

                break;

            default:
                return(base.ActivateByObject(ObjectUsed));

                break;
            }
        }
        return(false);
    }
예제 #8
0
    /// <summary>
    /// Detects if a talisman has been thrown into the abyss lava trigger.
    /// </summary>
    /// <param name="other">Other.</param>
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.GetComponent <ObjectInteraction>() != null)
        {
            if (Quest.instance.isGaramonBuried == false)
            {
                return;
            }
            ObjectInteraction objInt = other.gameObject.GetComponent <ObjectInteraction>();
            switch (objInt.item_id)
            {
            case Quest.TalismanHonour:
            case Quest.TalismanBook:
            case Quest.TalismanCup:
            case Quest.TalismanRing:
            case Quest.TalismanShield:
            case Quest.TalismanSword:
            case Quest.TalismanTaper:
            case Quest.TalismanTaperLit:
            case Quest.TalismanWine:
                Quest.instance.TalismansRemaining--;
                break;

            default:
                return;
            }

            Impact.SpawnHitImpact(Impact.ImpactMagic(), objInt.GetImpactPoint(), 40, 44);


            objInt.consumeObject();

            //Suck the avatar into the ethereal void.
            if (Quest.instance.TalismansRemaining <= 0)
            {
                StartCoroutine(SuckItAvatar());
            }
        }
    }
예제 #9
0
    /// <summary>
    /// Activation of this object by another. EG key on door
    /// </summary>
    /// <returns>true</returns>
    /// <c>false</c>
    /// <param name="ObjectUsed">Object used.</param>
    /// Using oil on the lantern increases it's quality.
    public override bool ActivateByObject(GameObject ObjectUsed)
    {
        //000~001~178~You think it is a bad idea to add oil to the lit lantern. \n
        //000~001~179~Adding oil, you refuel the lantern. \n
        //000~001~180~The lantern is already full. \n
        ObjectInteraction objIntUsed = ObjectUsed.GetComponent <ObjectInteraction>();

        if (objIntUsed != null)
        {
            switch (objIntUsed.GetItemType())
            {
            case ObjectInteraction.OIL:
                if (IsOn() == true)
                {
                    UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, StringController.str_you_think_it_is_a_bad_idea_to_add_oil_to_the_lit_lantern_));
                }
                else
                {
                    if (objInt().quality == 64)
                    {
                        UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, StringController.str_the_lantern_is_already_full_));
                    }
                    else
                    {
                        UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, StringController.str_adding_oil_you_refuel_the_lantern_));
                        objInt().quality = 64;
                        objIntUsed.consumeObject();
                    }
                }
                UWHUD.instance.CursorIcon = UWHUD.instance.CursorIconDefault;
                UWCharacter.Instance.playerInventory.ObjectInHand = "";
                return(true);

            default:
                return(base.ActivateByObject(ObjectUsed));
            }
        }
        return(false);
    }
    /// <summary>
    /// Destroys the bridges in a line
    /// </summary>
    /// <param name="triggerX"></param>
    /// <param name="triggerY"></param>
    void DestroyBridges(int triggerX, int triggerY)
    {
        int dirX = 0; int dirY = 0;

        GetDirectionsForBridgeTrap(ref dirX, ref dirY);

        for (int i = 0; i < quality; i++)
        {
            int tileX = triggerX + dirX * i;
            int tileY = triggerY + dirY * i;
            if (TileMap.ValidTile(tileX, tileY))
            {
                int index = ObjectLoader.findObjectByTypeInTile(CurrentObjectList().objInfo, (short)tileX, (short)tileY, ObjectInteraction.BRIDGE);
                //Create a bridge at this tile. Only if no bridge is already there.
                if (index != -1)
                {
                    ObjectInteraction obj = ObjectLoader.getObjectIntAt(index);
                    obj.consumeObject();
                }
            }
        }
    }
 public override bool ActivateByObject(ObjectInteraction ObjectUsed)
 {
     //Test for a valid rune being used on the bag and if so add the rune to the players inventory.
     if (ObjectUsed.GetComponent <RuneStone>() != null)
     {
         UWCharacter.Instance.PlayerMagic.PlayerRunes[ObjectUsed.item_id - 232] = true;
         //Add rune to rune bag and destroy the original object.
         ObjectUsed.consumeObject();
         CurrentObjectInHand = null;
         //UWHUD.instance.CursorIcon= UWHUD.instance.CursorIconDefault;
         return(true);
     }
     else
     {
         if (UWCharacter.InteractionMode == UWCharacter.InteractionModeUse)
         {
             return(ObjectUsed.FailMessage());
         }
         else
         {
             return(false);
         }
     }
 }
예제 #12
0
    /// <summary>
    /// Mixs the rotworm stew.
    /// </summary>
    /// <returns><c>true</c>, if rotworm stew was mixed, <c>false</c> otherwise.</returns>
    bool MixRotwormStew()
    {
        bool hasPort               = false;
        ObjectInteraction port     = null;
        bool hasGreenMushroom      = false;
        ObjectInteraction mushroom = null;
        bool hasCorpse             = false;
        ObjectInteraction corpse   = null;
        bool hasExtraItems         = false;
        //Find a bowl in the players inventory.
        //Check if it only contains port, a rotworm corpse and a greenmushroom.

        //000~001~148~The bowl does not contain the correct ingredients. \n
        //000~001~149~You mix the ingredients into a stew. \n
        //000~001~150~You need a bowl to mix the ingredients. \n
        Container cn = UWCharacter.Instance.playerInventory.playerContainer;

        if (cn != null)
        {
            ObjectInteraction bowl = cn.findItemOfType(142); //Finds the first bowl in the inventory;
            // if (BowlName != "")
            //{
            //GameObject bowl = GameObject.Find(BowlName);
            if (bowl != null)
            {
                //Search for
                Container bowlContainer = bowl.GetComponent <Container>();
                if (bowlContainer != null)
                {
                    for (short i = 0; i <= bowlContainer.GetCapacity(); i++)
                    {
                        ObjectInteraction foundItemObj = bowlContainer.GetItemAt(i);
                        if (foundItemObj != null)
                        {
                            switch (foundItemObj.item_id)
                            {
                            case 184:        //Mushroom
                                mushroom         = foundItemObj;
                                hasGreenMushroom = true; break;

                            case 190:        //Port
                                port    = foundItemObj;
                                hasPort = true; break;

                            case 217:        //Rotworm Corpse
                                corpse    = foundItemObj;
                                hasCorpse = true; break;

                            default:
                                hasExtraItems = true; break;
                            }
                        }
                    }
                    //Has a bowl. Now test contents.
                    if (
                        (hasCorpse) && (hasGreenMushroom) && (hasPort) &&
                        (!hasExtraItems)
                        )
                    {    //Mix port
                         //000~001~149~You mix the ingredients into a stew. \n
                        UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 149));
                        //Consume the items
                        port.consumeObject();
                        corpse.consumeObject();
                        mushroom.consumeObject();

                        ObjectInteraction bowlObjectInt = bowl.GetComponent <ObjectInteraction>();
                        bowlObjectInt.ChangeType(283);
                        Destroy(bowlContainer);    //Remove the container from the object.
                        bowl.gameObject.AddComponent <Food>();
                        bowlObjectInt.isquant = 1;
                        bowlObjectInt.link    = 1;
                        return(true);
                    }
                    else
                    {    //We don't have the items
                         //000~001~148~The bowl does not contain the correct ingredients. \n
                        UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 148));
                        return(true);
                    }
                }
            }
            //}
        }
        //000~001~150~You need a bowl to mix the ingredients. \n
        UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 150));
        return(true);
    }
예제 #13
0
    public override bool ActivateByObject(GameObject ObjectUsed)
    {    //Code for handling otherobjects used on this object
         //Doors can be used by keys, picks and spikes.
        //ObjectInteraction objIntThis = this.GetComponent<ObjectInteraction>();
        ObjectInteraction objIntUsed = ObjectUsed.GetComponent <ObjectInteraction>();

        if (objIntUsed != null)
        {
            switch (objIntUsed.ItemType)
            {
            case ObjectInteraction.KEY:                     //Key
                DoorKey dk = ObjectUsed.GetComponent <DoorKey>();
                if (dk != null)
                {
                    if (state == true)
                    {
                        //Door is already open
                        ml.Add(playerUW.StringControl.GetString(1, 6));
                        return(true);
                    }

                    if (KeyIndex == dk.KeyId)                         //This is a valid key for the door.
                    {
                        ToggleLock();
                        if (locked == true)
                        {                                        //Locked message
                            ml.Add(playerUW.StringControl.GetString(1, 4));
                        }
                        else
                        {                                        //Unlockedmessage
                            ml.Add(playerUW.StringControl.GetString(1, 5));
                        }
                        return(true);
                    }
                    else
                    {
                        if (KeyIndex == 53)
                        {                                //There is no lock
                            ml.Add(playerUW.StringControl.GetString(1, 3));
                        }
                        else
                        {                                //That is the wrong key.
                            ml.Add(playerUW.StringControl.GetString(1, 2));
                        }
                        return(true);
                    }
                }
                break;

            case ObjectInteraction.LOCKPICK:                            //lockpick
            {
                if (Pickable == true)
                {
                    if (playerUW.PlayerSkills.TrySkill(Skills.SkillPicklock, objIntUsed.Quality))
                    {
                        ml.Add(playerUW.StringControl.GetString(1, 121));
                        UnlockDoor();
                    }
                    else
                    {
                        //Debug.Log ("Picklock failed!");
                        ml.Add(playerUW.StringControl.GetString(1, 120));
                        objIntUsed.consumeObject();
                    }
                }
                else
                {
                    ml.Add(playerUW.StringControl.GetString(1, 120));
                }
                break;
            }

            case ObjectInteraction.SPIKE:
            {
                if (Spiked == false)
                {
                    //000~001~128~You can only spike closed doors.
                    //000~001~129~The door is now spiked closed.
                    //000~001~130~Please select door to spike...
                    //000~001~131~The door is spiked.
                    if (state == false)
                    {                                    //Closed door
                        ml.Add(playerUW.StringControl.GetString(1, 129));
                        Spiked = true;
                        objIntUsed.consumeObject();
                    }
                    else
                    {
                        ml.Add(playerUW.StringControl.GetString(1, 128));
                    }
                }
                else
                {
                    ml.Add(playerUW.StringControl.GetString(1, 131));
                }
                return(true);
            }

            default:
                return(false);
            }
        }
        else
        {
            return(false);
        }
        return(true);
    }
예제 #14
0
    /// <summary>
    /// Launchs the ammo.
    /// </summary>
    /// <returns><c>true</c>, if ammo was launched, <c>false</c> otherwise.</returns>
    bool LaunchAmmo(float charge)
    {
        if (currentAmmo != null)
        {
            Ray ray;
            if (UWCharacter.Instance.MouseLookEnabled == true)
            {
                ray = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0f));
            }
            else
            {
                ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            }

            RaycastHit hit       = new RaycastHit();
            float      dropRange = 0.5f;
            if (!Physics.Raycast(ray, out hit, dropRange))
            {///Checks No object interferes with the launch
                float      force = 1000.0f * (charge / 100.0f);
                GameObject launchedItem;
                if (currentAmmo.GetQty() == 1)
                {
                    launchedItem = currentAmmo.gameObject;
                    UWCharacter.Instance.playerInventory.RemoveItem(currentAmmo);
                    //launchedItem.transform.parent=GameWorldController.instance.DynamicObjectMarker();
                    GameWorldController.MoveToWorld(launchedItem);
                    launchedItem.transform.position = ray.GetPoint(dropRange - 0.1f);
                }
                else
                {//reduce this quantity by one and create a copy in the world
                    ObjectLoaderInfo newobjt = ObjectLoader.newWorldObject(currWeaponRanged.AmmoType(), 40, 0, 1, 256);
                    launchedItem = ObjectInteraction.CreateNewObject(CurrentTileMap(), newobjt, CurrentObjectList().objInfo, GameWorldController.instance.DynamicObjectMarker().gameObject, ray.GetPoint(dropRange - 0.1f)).gameObject;
                    currentAmmo.consumeObject();
                }
                launchedItem.GetComponent <ObjectInteraction>().isquant = 1;
                UnFreezeMovement(launchedItem);
                Vector3 ThrowDir = ray.GetPoint(dropRange) - ray.origin;

                ///Apply the force along the direction of the ray that the player has targetted along.
                launchedItem.GetComponent <Rigidbody>().AddForce(ThrowDir * force);
                GameObject myObjChild = new GameObject(launchedItem.name + "_damage");
                myObjChild.transform.position = launchedItem.transform.position;
                myObjChild.transform.parent   = launchedItem.transform;
                ///Appends ProjectileDamage to the projectile to act as the damage delivery method.
                ProjectileDamage pd = myObjChild.AddComponent <ProjectileDamage>();
                pd.Source       = UWCharacter.Instance.gameObject;
                pd.Damage       = (short)currWeaponRanged.Damage(); //   (short)(10.0f*(Charge/100.0f));
                pd.AttackCharge = charge;
                pd.AttackScore  = UWCharacter.Instance.PlayerSkills.GetSkill(Skills.SkillAttack) / 2 + UWCharacter.Instance.PlayerSkills.GetSkill(Skills.SkillMissile);
                return(true);
            }
            else
            {
                return(false);
            }
        }
        else
        {//No ammo?? Should not happen
            return(false);
        }
    }
예제 #15
0
    public override bool ActivateByObject(ObjectInteraction ObjectUsed)
    {    //Code for handling otherobjects used on this object
         //Doors can be used by keys, picks and spikes.
        //ObjectInteraction objIntUsed = ObjectUsed.GetComponent<ObjectInteraction>();
        if (ObjectUsed != null)
        {
            switch (ObjectUsed.GetItemType())
            {
            case ObjectInteraction.KEY:                     //Key
                DoorKey dk = ObjectUsed.GetComponent <DoorKey>();
                if (dk != null)
                {
                    if (state() == true)
                    {
                        //Door is already open
                        UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 6));
                        return(true);
                    }
                    ObjectInteraction doorlock = getLockObjInt();
                    if (doorlock == null)
                    {
                        UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 3));
                        return(false);
                    }
                    if ((doorlock.link & 0x3F) == dk.owner)                         //This is a valid key for the door.
                    {
                        ToggleLock(true);
                        if (locked() == true)
                        {                                        //Locked message
                            UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 4));
                        }
                        else
                        {                                        //Unlockedmessage
                            UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 5));
                        }
                        return(true);
                    }
                    else
                    {
                        if (link == 53)
                        {                                //There is no lock
                            UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 3));
                        }
                        else
                        {                                //That is the wrong key.
                            UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 2));
                        }
                        return(true);
                    }
                }
                break;

            case ObjectInteraction.LOCKPICK:                            //lockpick
            {
                //lock pick skill check is based on the zpos of the "lock" object * 3 vs the players (lockpick skill + 1)
                //Locks cannot be picked if the zpos is 0xE or greater. In either case the skillcheck is attempted.
                ObjectInteraction LockObject = getLockObjInt();
                if (LockObject != null)
                {
                    int skillvalue  = UWCharacter.Instance.PlayerSkills.PickLock + 1;
                    int targetvalue = LockObject.zpos * 3;
                    Skills.SkillRollResult skillroll = Skills.SkillRoll(skillvalue, targetvalue);

                    if (LockObject.zpos >= 0xE)
                    {        //unpickable
                        if (skillroll == Skills.SkillRollResult.CriticalFailure)
                        {
                            BreakLockPick(ObjectUsed);
                        }
                        else
                        {
                            UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, StringController.str_your_lockpicking_attempt_failed_));
                        }
                    }
                    else
                    {
                        switch (skillroll)
                        {
                        case Skills.SkillRollResult.CriticalFailure:
                        {
                            BreakLockPick(ObjectUsed);
                            break;
                        }

                        case Skills.SkillRollResult.Failure:
                        {
                            UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, StringController.str_your_lockpicking_attempt_failed_));
                            break;
                        }

                        case Skills.SkillRollResult.Success:
                        case Skills.SkillRollResult.CriticalSuccess:
                        {
                            UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, StringController.str_you_succeed_in_picking_the_lock_));
                            UnlockDoor(true);
                            break;
                        }
                        }
                    }
                }
                else
                {
                    UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 3));        //There is no lock on that.
                }
            }
            break;

            //{
            //if (Pickable==true)
            //	{
            //		if (UWCharacter.Instance.PlayerSkills.TrySkill(Skills.SkillPicklock, Skills.DiceRoll(1,25)))
            //		{
            //		UWHUD.instance.MessageScroll.Add (StringController.instance.GetString (1,StringController.str_you_succeed_in_picking_the_lock_));
            //		UnlockDoor(true);
            //		}
            //	else
            //		{
            //		//Debug.Log ("Picklock failed!");
            //		UWHUD.instance.MessageScroll.Add (StringController.instance.GetString (1,StringController.str_your_lockpicking_attempt_failed_));
            //		//objIntUsed.consumeObject();
            //		}
            //	}
            //else
            //	{
            //		UWHUD.instance.MessageScroll.Add (StringController.instance.GetString (1,StringController.str_your_lockpicking_attempt_failed_));
            //	}
            //break;
            //}
            case ObjectInteraction.SPIKE:
            {
                if (Spike())
                {
                    ObjectUsed.consumeObject();
                }
                break;
            }

            default:
                return(false);
            }
        }
        else
        {
            return(false);
        }
        return(true);
    }
예제 #16
0
    public override bool ActivateByObject(GameObject ObjectUsed)
    {    //Code for handling otherobjects used on this object
         //Doors can be used by keys, picks and spikes.
        ObjectInteraction objIntUsed = ObjectUsed.GetComponent <ObjectInteraction>();

        if (objIntUsed != null)
        {
            switch (objIntUsed.GetItemType())
            {
            case ObjectInteraction.KEY:                     //Key
                DoorKey dk = ObjectUsed.GetComponent <DoorKey>();
                if (dk != null)
                {
                    if (state() == true)
                    {
                        //Door is already open
                        UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 6));
                        return(true);
                    }
                    ObjectInteraction doorlock = getLockObjInt();
                    if (doorlock == null)
                    {
                        UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 3));
                        return(false);
                    }
                    if ((doorlock.link & 0x3F) == dk.objInt().owner)                         //This is a valid key for the door.
                    {
                        ToggleLock(true);
                        if (locked() == true)
                        {                                        //Locked message
                            UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 4));
                        }
                        else
                        {                                        //Unlockedmessage
                            UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 5));
                        }
                        return(true);
                    }
                    else
                    {
                        if (objInt().link == 53)
                        {                                //There is no lock
                            UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 3));
                        }
                        else
                        {                                //That is the wrong key.
                            UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 2));
                        }
                        return(true);
                    }
                }
                break;

            case ObjectInteraction.LOCKPICK:                            //lockpick
            {
                if (Pickable == true)
                {
                    if (UWCharacter.Instance.PlayerSkills.TrySkill(Skills.SkillPicklock, Random.Range(1, 25)))
                    {
                        UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, StringController.str_you_succeed_in_picking_the_lock_));
                        UnlockDoor(true);
                    }
                    else
                    {
                        //Debug.Log ("Picklock failed!");
                        UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, StringController.str_your_lockpicking_attempt_failed_));
                        //objIntUsed.consumeObject();
                    }
                }
                else
                {
                    UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, StringController.str_your_lockpicking_attempt_failed_));
                }
                break;
            }

            case ObjectInteraction.SPIKE:
            {
                if (Spike())
                {
                    objIntUsed.consumeObject();
                }
                break;
            }

            default:
                return(false);
            }
        }
        else
        {
            return(false);
        }
        return(true);
    }
예제 #17
0
    /// <summary>
    /// Activation of this object by another. EG key on door
    /// </summary>
    /// <returns>true</returns>
    /// <c>false</c>
    /// <param name="ObjectUsed">Object used.</param>
    /// Special case here for Garamon's grave. Activates a hard coded trigger
    public override bool ActivateByObject(ObjectInteraction ObjectUsed)
    {
        //ObjectInteraction objIntUsed = ObjectUsed.GetComponent<ObjectInteraction>();
        if (GraveID() == 5)
        {                                  //Garamon's grave
            //Activates a trigger a_move_trigger_54_52_04_0495 (selected by unknown means)
            if (ObjectUsed.item_id == 198) //Bones
            {
                if (ObjectUsed.quality == 63)
                {                        //Garamons bones
                    //Arise Garamon.
                    //000~001~134~You thoughtfully give the bones a final resting place.
                    UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, StringController.str_you_thoughtfully_give_the_bones_a_final_resting_place_));

                    ObjectInteraction trigObj = CurrentObjectList().objInfo[495].instance;
                    if (trigObj != null)
                    {
                        link++;                        //Update the grave description
                        ObjectUsed.consumeObject();
                        trigObj.GetComponent <trigger_base>().Activate(this.gameObject);
                        Quest.instance.isGaramonBuried = true;
                        CurrentObjectInHand            = null;
                        //Garamon does not initiate conversation normally so I force the conversation.
                        GameObject garamon = GameObject.Find(a_create_object_trap.LastObjectCreated);
                        if (garamon != null)
                        {
                            if (garamon.GetComponent <NPC>() != null)
                            {
                                garamon.GetComponent <NPC>().TalkTo();
                            }
                        }
                    }
                    CurrentObjectInHand = null;
                    return(true);
                }
                else
                {                        //Regular bones
                    //000~001~259~The bones do not seem at rest in the grave, and you take them back.
                    UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 259));
                    CurrentObjectInHand = null;
                    return(true);
                }
            }
            else
            {
                return(ObjectUsed.FailMessage());
            }
        }
        else
        {
            if ((ObjectUsed.item_id == 198) && (ObjectUsed.quality == 63))        //Garamons Bones used on the wrong grave
            {
                //000~001~259~The bones do not seem at rest in the grave, and you take them back.
                UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 259));
                CurrentObjectInHand = null;
                return(true);
            }
            else
            {
                CurrentObjectInHand = null;
                return(ObjectUsed.FailMessage());
            }
        }
    }
예제 #18
0
    /// <summary>
    /// The player goes to sleep
    /// </summary>
    public void Sleep()
    {
        //Rules to implement for sleeping
        //Only sleep if there are no hostile monsters nearby.
        //If a normal sleep do a fade to black in the small cutscene window.
        //If hungry then it is an uneasy sleep.
        //There is a small chance of a monster spawning.
        //If a dream/vision use the full screen.
        //Do a incense dream before a garamon dream. Turn the incense into ashes afterwards
        //Do one Garamon dream per game day.
        //When tybal is dead. Jump to the bury the bones dream
        //Restore an amount of health or mana after a sleep.
        //Track the state of the garamon/cup of wonder dreams in Quest.

        /*
         * 000~001~014~There are hostile creatures near!
         * 000~001~015~You make camp.
         * 000~001~016~You go to sleep.
         * 000~001~017~You are starving.
         * 000~001~018~You feel rested.
         * 000~001~019~Your sleep is uneasy.
         * 000~001~020~You can't go to sleep here!
         * 000~001~021~Your sleep is interrupted!
         */

        if (!CheckForMonsters())
        {
            ObjectInteraction incense = UWCharacter.Instance.playerInventory.findObjInteractionByID(277);
            if (incense != null)
            {
                UWHUD.instance.EnableDisableControl(UWHUD.instance.CutsceneFullPanel.gameObject, true);
                //UWHUD.instance.CutScenesFull.SetAnimationFile="FadeToBlackSleep";
                incense.consumeObject();
                switch (Quest.instance.getIncenseDream())
                {
                case 0:
                    UWHUD.instance.CutScenesFull.SetAnimationFile = "cs013_n01"; break;

                case 1:
                    UWHUD.instance.CutScenesFull.SetAnimationFile = "cs014_n01"; break;

                case 2:
                    UWHUD.instance.CutScenesFull.SetAnimationFile = "cs015_n01"; break;
                }
            }
            else
            {
                if (UWCharacter.Instance.FoodLevel >= 3)
                {
                    if (IsGaramonTime())
                    {                                                            //PLay a garamon dream
                        PlayGaramonDream(Quest.instance.GaramonDream++);
                    }
                    else
                    {                                                            //Regular sleep with a fade to black
                        StartCoroutine(SleepDelay());
                        //UWHUD.instance.EnableDisableControl(UWHUD.instance.CutsceneFullPanel.gameObject,true);
                        //UWHUD.instance.CutScenesFull.SetAnimationFile="FadeToBlackSleep";
                    }
                }
            }
            for (int i = UWCharacter.Instance.Fatigue; i < 29; i = i + 3)                           //Sleep restores at a rate of 3 points per hour
            {
                if (UWCharacter.Instance.FoodLevel >= 3)
                {
                    GameClock.Advance();                                                            //Move time forward.
                }
                else
                {                                                //Too hungry to sleep.
                    UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 17));
                    UWHUD.instance.EnableDisableControl(UWHUD.instance.CutsceneFullPanel, false);
                    UWCharacter.Instance.Fatigue += i;
                    return;                                                            // true;
                }
            }
            UWCharacter.Instance.Fatigue = 29;   //Fully rested
            if (UWCharacter.Instance.CurVIT < UWCharacter.Instance.MaxVIT)
            {                                    //Random regen of an amount of health
                UWCharacter.Instance.CurVIT += Random.Range(1, UWCharacter.Instance.MaxVIT - UWCharacter.Instance.CurVIT + 1);
            }
            if (UWCharacter.Instance.PlayerMagic.CurMana < UWCharacter.Instance.PlayerMagic.MaxMana)
            {                                    //Random regen of an amount of mana
                UWCharacter.Instance.PlayerMagic.CurMana += Random.Range(1, UWCharacter.Instance.PlayerMagic.MaxMana - UWCharacter.Instance.PlayerMagic.CurMana + 1);
            }
        }
        else
        {
            UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 14));
        }
    }