コード例 #1
0
    // this creates a GameObject with a corresponding Trap on it, and stores it inside of the trapPositionalData
    public void SetTrap(Vector2Int position, TrapType trap, Unit source, UnitAbility ability)
    {
        // parse the spawn location and spawn a new object there
        Vector3    pos     = MapMath.MapToWorld(position.x, position.y);
        GameObject shell   = new GameObject();
        GameObject newTrap = Instantiate(shell, pos, Quaternion.identity);

        Destroy(shell);

        // add the correct inherited member of Trap to the object
        Trap newTrapComponent = null;

        switch (trap)
        {
        case TrapType.Claymore:
            newTrapComponent = newTrap.AddComponent <ClaymoreTrap>() as ClaymoreTrap;
            break;

        default:
            break;
        }

        newTrapComponent.mapPosition    = position;
        newTrapComponent.sourceUnit     = source;
        newTrapComponent.placingAbility = ability;
        newTrap.AddComponent <SpriteRenderer>();
        Sprite newSprite = Resources.Load <Sprite>(newTrapComponent.GetResourcePath());

        newTrap.GetComponent <SpriteRenderer>().sprite       = newSprite;
        newTrap.GetComponent <SpriteRenderer>().sortingOrder = 98;
        trapPositionalData.AddTrap(position, newTrapComponent);
    }
コード例 #2
0
ファイル: Trap.cs プロジェクト: stephenhou2/NewWordJourney
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="mapIndex">Map index.</param>
        /// <param name="attachedInfo">Attached info.</param>
        public override void InitializeWithAttachedInfo(int mapIndex, MapAttachedInfoTile attachedInfo)
        {
            transform.position      = attachedInfo.position;
            bc2d.enabled            = true;
            mapItemRenderer.enabled = true;

            //Debug.Log(attachedInfo.type);

            switch (attachedInfo.type)
            {
            case "thornTrap":
                trapType = TrapType.Thorn;
                mapItemRenderer.sprite = thornTrapOffSprite;
                break;

            case "fireTrap":
                trapType = TrapType.Fire;
                mapItemRenderer.sprite = fireTrapSprite;
                break;

            case "poisonTrap":
                trapType = TrapType.Poison;
                mapItemRenderer.sprite = poisonTrapSprite;
                break;
            }
        }
コード例 #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Description")] TrapType trapType)
        {
            if (id != trapType.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(trapType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TrapTypeExists(trapType.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(trapType));
        }
コード例 #4
0
    public void Awake()
    {
        canDrop = false;

        SlctdTrap = TrapType.Glue;

        spawnDistance = 1.0f;

        // Set key code:
        key = KeyCode.LeftControl;

        avatarController = GetComponent<AvatarController>();

        // ToolTip text
        ToolTip.Description = "Places a Glue trap.\nSlows down enemies.";

        ToolTip.FirstLabel =        "Slow Rate:";
        ToolTip.FirstAttribute =    " 30%";

        ToolTip.SecondLabel =       "Duration:";
        ToolTip.SecondAttribute =   "5 sec";

        ToolTip.ThirdLabel =        "";
        ToolTip.ThirdAttribute =    "";
    }
コード例 #5
0
        public override bool ExecuteTrap(Mobile from)
        {
            //In order to REQUIRE the remove trap skill for
            //Treasure Map Chests, make sure that the trap resets immediately
            //after the trap is tripped.
            TrapType originaltrap = TrapType;

            bool bReturn = base.ExecuteTrap(from);

            //reset trap!
            TrapType = originaltrap;

            // adam: reset decay timer when the trap is messed with
            if (m_Timer != null)
            {
                m_Timer.Stop();

                m_Timer = null;

                // adam: once the trap has been tripped, it decays in 15 minutes
                m_DeleteTime = DateTime.Now + TimeSpan.FromMinutes(1 * 15.0);
                from.SendMessage("The chest begins to decay.");

                m_Timer = new DeleteTimer(this, m_DeleteTime);
                m_Timer.Start();
            }

            return(bReturn);
        }
コード例 #6
0
    //Activates the Trap
    void ActivateTrap(TrapType _MyType)
    {
        // Activate trap
        mustApplyEffect = true;

        switch (_MyType)
        {
            case TrapType.Poison:
                // Start Particle system
                PSys.Play();
                PSys.loop = true;

                StartCoroutine(EffectTimer(EffectTime));
                StartCoroutine(DurationTimer(Duration));
                break;

            case TrapType.Glue:
                // Start Particle system
                PSys.Play();
                PSys.loop = true;

                //mustApplyEffect is always true for GlueTrap
                StartCoroutine(DurationTimer(Duration));
                break;

            case TrapType.Spring:
                Debug.Log("Spring Trap not implemented yet");
                break;

            default:
                Debug.Log("Activate Trap: Trap type not found");
                break;
        }
    }
コード例 #7
0
    // Applies the Trap Effect on a Target.
    void ApplyTrapEffect(TrapType _MyType, GameObject TargetObj)
    {
        switch (_MyType)
        {
            case TrapType.Poison:
                // Test for a Script exclusive to the traper to avoid aplying damage multiple times.
                if (TrapPlayerObj.GetComponent<SetTrapPoison>() != null)
                {   // Apply Poison Damage
                    TrapPlayerObj.GetComponent<AvatarNetworkBehavior>().CmdAssignDamage(TargetObj, PoisonDamage);
                }
                break;

            case TrapType.Glue:
                // Test for a Script exclusive to the traper to avoid setting target to slow multiple times.
                if (TrapPlayerObj.GetComponent<SetTrapGlue>() != null)
                {   // Apply Glue slow down
                    TrapPlayerObj.GetComponent<AvatarNetworkBehavior>().CmdStartSlowDown(TargetObj, GlueSlowRate);
                }
                break;

            case TrapType.Spring:
                Debug.Log("Spring Trap not implemented yet");
                break;

            default:
                Debug.Log("Apply Trap Effect: Trap type not found");
                break;
        }

        if (MyType != TrapType.Glue)
        {
            // Reset for Effect timer.
            mustApplyEffect = false;
        }
    }
コード例 #8
0
        //------------------------------------
        public void DisplayElement(IDefinition definition)
        {
            m_definition = definition;
            TrapType notificationType = definition.Entity as TrapType;

            m_exLinkField.FillDialogFromObjet(notificationType);

            //Ajoute les \r à la description
            string strDesc = definition.Description;

            if (!strDesc.Contains("\r"))
            {
                strDesc = strDesc.Replace("\n", "\r\n");
            }
            m_lblDescription.Text = strDesc;

            //Récupère l'OID
            m_lblOID.Text = ObjectIdentifier.Convert(definition.GetNumericalForm());



            m_wndListeObjects.Items.Clear();
            foreach (string strObject in notificationType.Variables)
            {
                m_wndListeObjects.Items.Add(strObject);
            }
        }
コード例 #9
0
        public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue)
        {
            TrapType type = TrapType.DartTrap;

            if (this is DartTrap)
            {
                type = TrapType.DartTrap;
            }
            else if (this is PoisonTrap)
            {
                type = TrapType.PoisonTrap;
            }
            else if (this is ExplosionTrap)
            {
                type = TrapType.ExplosionTrap;
            }

            from.EndAction(typeof(CraftSystem));

            from.Target = new TrapTarget(this, type, craftSystem, tool, typeRes, craftItem, resHue);

            from.SendLocalizedMessage(502923);               // What would you like to set a trap on?

            return(quality);
        }
コード例 #10
0
    public void BuildTrap()
    {
        if (isEmpty)
        {
            isEmpty = false;
        }
        else
        {
            Destroy(trapSpot.GetChild(0).gameObject);
        }

        trapType = selectedTrap;

        isCraftable = isCurrentCraftable;

        GameObject trap = Instantiate(currentTrapPrefab, trapSpot);

        trap.transform.position = transform.position;

        levelManager.UpdateMoney(-currentPrice);

        AudioManagerScript.instance.PlaySound(trapPlaceSound, name);

        uIManager.CollapseTrapMenu();
    }
コード例 #11
0
 private void SpawnObjGrabbed(TrapType type)
 {
     //Instantiate obj
     this.objSelected = GameObject.Instantiate <GameObject>(this.trapSpawnInfo[type].objPrefab);
     //Set item to inactive
     this.objSelected.SetActive(false);
 }
コード例 #12
0
    bool TrapViabilityCheck(TrapType _trap)
    {
        switch (_trap)
        {
        case TrapType.MoveHorizontal:
            if (Physics.Raycast(new Ray(transform.position, transform.rotation * Vector3.right), gameplay.movingDistance))
            {
                canMoveRight = false;
            }
            if (Physics.Raycast(new Ray(transform.position, transform.rotation * Vector3.left), gameplay.movingDistance))
            {
                canMoveLeft = false;
            }
            return(canMoveRight || canMoveLeft);

        case TrapType.MoveBackward:
            if (Physics.Raycast(new Ray(transform.position, transform.rotation * Vector3.back), gameplay.movingDistance))
            {
                return(false);
            }
            break;

        case TrapType.MoveDown:
            if (Physics.Raycast(new Ray(transform.position, transform.rotation * Vector3.down), gameplay.movingDistance))
            {
                return(false);
            }
            break;
        }

        return(true);
    }
コード例 #13
0
ファイル: TrapableContainer.cs プロジェクト: Pumpk1ns/RunZHA
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 2:
            {
                m_TrapLevel = reader.ReadInt();
                goto case 1;
            }

            case 1:
            {
                m_TrapPower = reader.ReadInt();
                goto case 0;
            }

            case 0:
            {
                m_TrapType = (TrapType)reader.ReadInt();
                break;
            }
            }
        }
コード例 #14
0
    // give status according to the trap type
    public void addStatusFromTraps(TrapType type, float damage = 0f)
    {
        switch (type)
        {
        case TrapType.BOMB_TRAP:
            addDamage(damage, TowerType.SNIPER);     // the bomb has the same hit attribute as the sniper
            break;

        case TrapType.FREEZE_TRAP:
            status           = EnemyStatus.FROZEN;
            conditionChanged = true;
            break;

        case TrapType.TIME_TRAP:
            if (status != EnemyStatus.FROZEN)
            {
                status           = EnemyStatus.STOPPED;
                conditionChanged = true;
            }
            break;

        default:
            break;
        }
    }
コード例 #15
0
 public void ChangeTrap(TrapType trapType)
 {
     this.currentTrap = trapType;
     if (PlayerPrefs.GetInt("IsNavigator") == 0)
     {
         PV.RPC("ChangeTrap", RpcTarget.Others, trapType);
     }
 }
コード例 #16
0
 public override void init_ObjectBase(ObjectBaseType _objectBaseType, int subtype, Node _node)
 {
     base.init_ObjectBase(_objectBaseType, subtype, _node);
     trapType   = (TrapType)subtype;
     turn_type  = Turn_Type.Object_turn;
     has_turns  = 1;
     is_collide = false;
 }
コード例 #17
0
    public AbstractTrapBehaviour GetTrapOfType(TrapType trapType)
    {
        var selectedTrapGo = AllTraps.FirstOrDefault(x => x.TrapType == trapType);

        selectedTrapGo.Model = TrapModel.GetTrapModelInfo(trapType);

        return(selectedTrapGo);
    }
コード例 #18
0
    public void CmdSetTrap(Vector3 position, TrapType _SlctdTrap)
    {
        GameObject spawnedTrap;

        switch (_SlctdTrap)
        {
            case TrapType.Poison:

                if (TrapsPrefab[0] != null)
                {
                    spawnedTrap = Instantiate(TrapsPrefab[0], position, Quaternion.identity) as GameObject;
                    spawnedTrap.transform.SetParent(TrapContainer);
                    NetworkServer.Spawn(spawnedTrap);
                }
                else
                {
                    Debug.Log("TrapsPrefab[0] == null. Did you forget to assign a prefab?");
                }
                break;

            case TrapType.Glue:

                if (TrapsPrefab[1] != null)
                {

                    spawnedTrap = Instantiate(TrapsPrefab[1], position, Quaternion.identity) as GameObject;
                    spawnedTrap.transform.SetParent(TrapContainer);
                    NetworkServer.Spawn(spawnedTrap);

                }
                else
                {
                    Debug.Log("TrapsPrefab[1] == null. Did you forget to assign a prefab?");
                }
                break;

            case TrapType.Spring:

                Debug.Log("Spring Trap not implemented yet");
                if (TrapsPrefab[2] != null)
                {
                    /*
                    spawnedTrap = Instantiate(TrapsPrefab[2], position, Quaternion.identity) as GameObject;
                    spawnedTrap.transform.SetParent(TrapContainer);
                    NetworkServer.Spawn(spawnedTrap);
                    */
                }
                else
                {
                    Debug.Log("TrapsPrefab[2] == null. Did you forget to assign a prefab?");
                }
                break;

            default:
                Debug.Log("Trap Type not found.");
                break;
        }//switch
    }
コード例 #19
0
    private void SpawnTrapInShop(TrapType type)
    {
        //Get trap spawn position
        Vector3 spawnPosition = this.trapSpawnInfo[type].spawnPosition;
        //Spawn trap
        GameObject obj = GameObject.Instantiate <GameObject>(this.trapSpawnInfo[type].objPrefab, this.shopItemsHolder.transform);

        obj.transform.position = spawnPosition;
    }
コード例 #20
0
        public void DisarmTrap(Mobile from)
        {
            SendMessageTo(from, 502999, 0x3B2); // You set off a trap!

            this.m_TrapType  = TrapType.None;
            this.m_TrapPower = 0;
            this.m_TrapLevel = 0;
            TrapEnabled      = false;
        }
コード例 #21
0
            public TrapSlot(byte data)
            {
                if (data == 0)
                {
                    return;
                }

                Level = (TrapLevel)data.GetLeftNiblet();
                Type  = (TrapType)data.GetRightNiblet();
            }
コード例 #22
0
 public TrapTarget(BaseCraftableTrap trap, TrapType type, CraftSystem craftSystem, BaseTool tool, Type typeRes, CraftItem craftItem, int resHue) : base(2, false, TargetFlags.None)
 {
     m_Trap        = trap;
     m_Type        = type;
     m_CraftSystem = craftSystem;
     m_Tool        = tool;
     m_typeRes     = typeRes;
     m_craftItem   = craftItem;
     m_resHue      = resHue;
 }
コード例 #23
0
    private void CreateTower(TrapType trapType)
    {
        if (playerIngameManager.CanCreateTrap(trapType) == false)
        {
            return;
        }

        this.TrapPlace.CreateNewTrap(trapType);
        playerIngameManager.CreateNewTrap(trapType);
    }
コード例 #24
0
ファイル: TrapableContainer.cs プロジェクト: jicomub/Temrael
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            m_TrapLevel = reader.ReadInt();
            m_TrapPower = reader.ReadInt();
            m_TrapType  = (TrapType)reader.ReadInt();
        }
コード例 #25
0
    public static GameObject CreateTile(Transform playerTransform, TileType tileType, TrapType trapType, int level, int index)
    {
        GameObject go = null;

        switch(tileType)
        {
        case TileType.MonsterTile:
            string path = "Prefab/Background/";

            int randNum = Random.Range (0, 3);

            switch(randNum)
            {
            case 0:
                path += "Easy/EasyTargetTile" + Random.Range(0, 2);
                break;

            case 1:
                path += "Normal/NormalTargetTile0";
                break;

            case 2:
                path += "Hard/HardTargetTile0";
                break;
            }

            go = (GameObject)Instantiate (Resources.Load (path));

            go.GetComponent<TargetTileController> ().SetTileInfo (TileType.MonsterTile, trapType, index);
            go.GetComponent<TargetTileController> ().SetTileMonster (playerTransform, level);

            return go;

        case TileType.Waypoint:
            go = (GameObject)Instantiate (Resources.Load ("Prefab/Background/Waypoint"));
            go.GetComponent<TargetTileController> ().SetTileInfo (TileType.Waypoint, trapType, index);

            return go;

        case TileType.HealthShrine:
        case TileType.ManaShrine:
        case TileType.CriticalShrine:
            go = (GameObject)Instantiate(Resources.Load("Prefab/Background/ComponentTile/ShrineTile"));
            go.GetComponent<TargetTileController>().SetTileInfo(tileType, trapType, index);
            return go;

        case TileType.TreasureBox:
            go = (GameObject)Instantiate(Resources.Load("Prefab/Background/ComponentTile/TreasureBoxTile"));
            go.GetComponent<TargetTileController>().SetTileInfo(tileType, trapType, index);
            return go;

        default:
            return null;
        }
    }
コード例 #26
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 5:
            {
                // removed the deco field (case 3)
                goto case 4;
            }

            case 4:
            {
                m_Enabled = reader.ReadBool();

                goto case 3;
            }

            case 3:
            {                           // obsolete deco field
                bool dummy;
                if (version < 5)
                {
                    dummy = reader.ReadBool();
                }
                goto case 2;
            }

            case 2:
            {
                m_TinkerMade   = reader.ReadBool();
                m_LastTrapType = (TrapType)reader.ReadInt();

                goto case 1;
            }

            case 1:
            {
                m_TrapPower = reader.ReadInt();

                goto case 0;
            }

            case 0:
            {
                m_TrapType = (TrapType)reader.ReadInt();

                break;
            }
            }
        }
コード例 #27
0
        public async Task <IActionResult> Create([Bind("Id,Name,Description")] TrapType trapType)
        {
            if (ModelState.IsValid)
            {
                _context.Add(trapType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(trapType));
        }
コード例 #28
0
 public bool IsLimited(TrapType trapType, int numTraps)
 {
     foreach (TrapLimit tl in this.trapLimits)
     {
         if (tl.IsLimited(trapType, numTraps))
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #29
0
 public int GetMaxTraps(TrapType trapType)
 {
     foreach (TrapLimit tl in this.trapLimits)
     {
         if (tl.Trap == trapType)
         {
             return(tl.MaxNum);
         }
     }
     Debug.LogError("GetMaxTraps: Did not find trap type: " + trapType);
     return(-1);
 }
コード例 #30
0
 private AbstractTrap GetTrap(TrapType trapType)
 {
     foreach (AbstractTrap trap in traps)
     {
         if (trap.GetTrapType() == trapType)
         {
             return(trap);
         }
     }
     Debug.LogError("Get Trap: No matching trap found.");
     return(null);
 }
コード例 #31
0
        public ArenaManager(GameUpdater env, int pixelWidth, int pixelHeight)
        {
            this.env = env;
            this.selectedTrapType = TrapType.NoType;

            this.pixelWidth = pixelWidth;
            this.pixelHeight = pixelHeight;

            this.arenaTranslation = new Point(0, 0);

            this.scrollPanel = new ScrollPanel(this, scrollPanelWidth, pixelWidth, pixelHeight);
        }
コード例 #32
0
ファイル: SanguineousTrap.cs プロジェクト: Pumpk1ns/outlands
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            if (version >= 0)
            {
                m_TrapType   = (TrapType)reader.ReadInt();
                m_Owner      = reader.ReadMobile();
                m_Expiration = reader.ReadDateTime();
                m_TrapSprung = reader.ReadBool();
            }
        }
コード例 #33
0
 private void IncrementTrap()
 {
     if (trapLimiter.IsLimited(currentTrap, trapCurrentNumber[(int)currentTrap]))
     {
         for (int i = 0; i < Enum.GetValues(typeof(TrapType)).Length; i++)
         {
             if (!trapLimiter.IsLimited((TrapType)i, trapCurrentNumber[i]))
             {
                 currentTrap = (TrapType)i;
                 return;
             }
         }
     }
 }
コード例 #34
0
    public int GetPrice(TrapType trapType)
    {
        int price = 0;

        foreach (TrapList trap in trapList)
        {
            if (trapType == trap.trapType)
            {
                price = trap.price;
                break;
            }
        }
        return(price);
    }
コード例 #35
0
        //---------------------------------------------------
        public void InitDialog(IDefinition definition, IObjectTree mibTree)
        {
            m_definition   = definition;
            m_trap         = m_definition.Entity as TrapType;
            m_notification = m_definition.Entity as NotificationType;


            InitComboVersions();
            InitComboGenericCode();

            m_cmbGenericCode.Text = GenericCode.EnterpriseSpecific.ToString();
            m_cmbTrapVersion.Text = VersionCode.V1.ToString();

            string strOID = ObjectIdentifier.Convert(m_definition.GetNumericalForm());

            if (strOID.IndexOf('.') >= 0)
            {
                string strGeneric = strOID.Substring(strOID.LastIndexOf('.') + 1);
                strOID = strOID.Substring(0, strOID.LastIndexOf('.'));
                m_txtSpecificCode.Text = strGeneric;
            }
            m_txtEntreprise.Text = strOID;
            m_txtCommunity.Text  = "public";

            m_panelVariables.SuspendDrawing();
            m_panelVariables.ClearAndDisposeControls();
            List <string> lstVariables = new List <string>();

            if (m_trap != null)
            {
                lstVariables.AddRange(m_trap.Variables);
            }
            else if (m_notification != null)
            {
                lstVariables.AddRange(m_notification.Objects);
            }
            foreach (string strVariable in lstVariables)
            {
                IDefinition defVar = mibTree.Find(strVariable);
                if (defVar != null)
                {
                    CControlTrapVariable ctrl = new CControlTrapVariable();
                    m_panelVariables.Controls.Add(ctrl);
                    ctrl.Dock = DockStyle.Top;
                    ctrl.BringToFront();
                    ctrl.Init(defVar);
                }
            }
            m_panelVariables.ResumeDrawing();
        }
コード例 #36
0
        public override bool ExecuteTrap(Mobile from)
        {
            //In order to REQUIRE the remove trap skill for
            //Treasure Map Chests, make sure that the trap resets immediately
            //after the trap is tripped.
            TrapType originaltrap = TrapType;

            bool bReturn = base.ExecuteTrap(from);

            //reset trap!
            TrapType = originaltrap;

            return(bReturn);
        }
コード例 #37
0
    public void Awake()
    {
        canDrop = false;

        SlctdTrap = TrapType.Poison;
        spawnDistance = 1.0f;

        // Set key code:
        key = KeyCode.LeftShift;
        avatarController = GetComponent<AvatarController>();

        // ToolTip text
        ToolTip.Description =       "Places a Poison trap.\nDamages enemies.";

        ToolTip.FirstLabel =        "Damage:";
        ToolTip.FirstAttribute =    "9 per sec";

        ToolTip.SecondLabel =       "Duration:";
        ToolTip.SecondAttribute =   "5 sec";

        ToolTip.ThirdLabel =        "";
        ToolTip.ThirdAttribute =    "";
    }
コード例 #38
0
        public virtual bool ExecuteTrap( Mobile from )
        {
            if ( m_TrapType != TrapType.None )
            {
                switch ( m_TrapType )
                {
                    case TrapType.ExplosionTrap:
                    {
                        from.SendAsciiMessage( "You set off a trap!" );

                        if ( from.InRange( GetWorldLocation(), 2 ) )
                        {
                            AOS.Damage( from, m_TrapPower, 0, 100, 0, 0, 0 );
                            from.SendAsciiMessage( "Your skin blisters from the heat!" );
                        }

                        Point3D loc = GetWorldLocation();

                        Effects.PlaySound( loc, Map, 0x307 );
                        Effects.SendLocationEffect( new Point3D( loc.X + 1, loc.Y + 1, loc.Z - 11 ), Map, 0x36BD, 15 );

                        break;
                    }
                    case TrapType.MagicTrap:
                    {
                        if ( from.InRange( GetWorldLocation(), 1 ) )
                            from.Damage( m_TrapPower );
                            //AOS.Damage( from, m_TrapPower, 0, 100, 0, 0, 0 );

                        Point3D loc = GetWorldLocation();

                        Effects.PlaySound( loc, Map, 0x307 );

                        Effects.SendLocationEffect( new Point3D( loc.X - 1, loc.Y, loc.Z ), Map, 0x36BD, 15 );
                        Effects.SendLocationEffect( new Point3D( loc.X + 1, loc.Y, loc.Z ), Map, 0x36BD, 15 );

                        Effects.SendLocationEffect( new Point3D( loc.X, loc.Y - 1, loc.Z ), Map, 0x36BD, 15 );
                        Effects.SendLocationEffect( new Point3D( loc.X, loc.Y + 1, loc.Z ), Map, 0x36BD, 15 );

                        Effects.SendLocationEffect( new Point3D( loc.X + 1, loc.Y + 1, loc.Z + 11 ), Map, 0x36BD, 15 );

                        break;
                    }
                    case TrapType.DartTrap:
                    {
                        AOS.Damage( from, m_TrapPower, 100, 0, 0, 0, 0 );

                        Effects.SendMovingEffect( this, from, 0x1BFE, 7, 0, false, false );
                        Effects.PlaySound( from.Location, from.Map, 0x234 );
                        break;
                    }
                    case TrapType.PoisonTrap:
                    {
                        if ( m_TrapPower < 30 )
                        {
                            from.Damage( m_TrapPower );
                            from.Poison = Poison.Lesser;
                        }
                        if ( m_TrapPower >= 30 && m_TrapPower < 50 )
                        {
                            from.Damage( m_TrapPower );
                            from.Poison = Poison.Regular;
                        }
                        if ( m_TrapPower >= 50 && m_TrapPower < 70 )
                        {
                            from.Damage( m_TrapPower );
                            from.Poison = Poison.Greater;
                        }
                        if ( m_TrapPower >= 70 && m_TrapPower < 90 )
                        {
                            from.Damage( m_TrapPower / 2 );
                            from.Poison = Poison.Deadly;
                        }
                        if ( m_TrapPower >= 90 )
                        {
                            from.Damage( m_TrapPower );
                            from.Poison = Poison.Lethal;
                        }

                        Point3D loc = GetWorldLocation();
                        Effects.PlaySound( loc, Map, 0x1DE );
                        Effects.SendLocationEffect( new Point3D( from.Location.X + 1, from.Location.Y + 1, from.Location.Z + 15 ), from.Map, 0x11A6, 48 );
                        break;
                    }
                }

                if ( m_PlayerTrapped == false )
                {
                    m_TrapType = TrapType.None;
                }
                return true;
            }

            return false;
        }
コード例 #39
0
 public void CmdSetTrapExplorer(Vector3 _position, TrapType _slctdTrap)
 {
     TrapSpawnManager.Instance.CmdSetTrap(_position, _slctdTrap);
 }
コード例 #40
0
ファイル: Tinkering.cs プロジェクト: FreeReign/Rebirth-Repack
        private void OnTrapTarget( TrapType type, object target )
        {
            if ( m_Mobile.Deleted || !m_Mobile.Alive || !CheckTool() )
            {
                End();
                return;
            }

            if ( !HasResources( 1, typeof( TrapableContainer ) ) )
            {
                OnNotEnoughResources();
                End();
                return;
            }

            if ( target is TrapableContainer && !(target is Pouch) )
            {
                TrapableContainer cont = (TrapableContainer)target;
                if ( cont.RootParent != m_Mobile && cont.RootParent != null)
                {
                    End();
                    m_Mobile.SendAsciiMessage( "That does not belong to you." );
                    return;
                }
                else if ( !m_Mobile.InRange( cont.GetWorldLocation(), 1 ) )
                {
                    End();
                    m_Mobile.SendAsciiMessage( "That is too far away." );
                    return;
                }
                else if ( cont.Trapped )
                {
                    End();
                    m_Mobile.SendAsciiMessage( "You can only place one trap at a time." );
                    return;
                }
                else if ( cont is LockableContainer && ((LockableContainer)cont).Locked )
                {
                    End();
                    m_Mobile.SendAsciiMessage( "You cannot trap a locked container." );
                    return;
                }

                Container pack = m_Mobile.Backpack;
                if ( pack == null )
                {
                    End();
                    m_Mobile.SendAsciiMessage( "You need additional resources to create the trap." );
                    return;
                }

                Item xres = null;
                switch ( type )
                {
                    case TrapType.DartTrap:
                        xres = pack.FindItemByType( typeof( Bolt ) );
                        if ( xres == null )
                            m_Mobile.SendAsciiMessage( "You need a crossbow bolt to make that trap." );
                        else
                            cont.TrapPower = (int)(m_Mobile.Skills[SkillName.Tinkering].Value / 10.0);
                        break;
                    case TrapType.PoisonTrap:
                        xres = pack.FindItemByType( typeof( BasePoisonPotion ) );
                        if ( xres == null )
                            m_Mobile.SendAsciiMessage( "You need a green potion to make that trap." );
                        else
                            cont.TrapPower = ((BasePoisonPotion)xres).Poison.Level + 1;
                        break;
                    case TrapType.ExplosionTrap:
                        xres = pack.FindItemByType( typeof( BaseExplosionPotion ) );
                        if ( xres == null )
                        {
                            m_Mobile.SendAsciiMessage( "You need a purple potion to make that trap." );
                        }
                        else
                        {
                            //BaseExplosionPotion pot = (BaseExplosionPotion)xres;
                            //cont.TrapPower = (int)(Utility.RandomMinMax( pot.MinDamage, pot.MaxDamage ) * ( m_Mobile.Skills[SkillName.Tinkering].Value / 10.0 ));
                            if ( xres is ExplosionPotion )
                                cont.TrapPower = 3;
                            else if ( xres is GreaterExplosionPotion )
                                cont.TrapPower = 5;
                            else //if ( xres is LesserExplosionPotion )
                                cont.TrapPower = 1;
                        }
                        break;
                }

                if ( xres == null || xres.Amount < 1 || !ConsumeResources( 1, typeof( TrapableContainer ) ) )
                {
                    OnNotEnoughResources();
                    End();
                    return;
                }
                xres.Consume( 1 );

                if ( m_Mobile.CheckSkill( SkillName.Tinkering, 0, 100 ) )
                {
                    cont.TrapType = type;
                    cont.Trapped = true;
                    cont.Trapper = m_Mobile;
                    m_Mobile.SendAsciiMessage( "You carefully set a trap on the container..." );
                }
                else
                {
                    cont.TrapPower = 0;
                    m_Mobile.SendAsciiMessage( "You failed to set the trap." );
                }
            }
            else
            {
                m_Mobile.SendAsciiMessage( "You can't trap that." );
            }
            End();
        }
コード例 #41
0
ファイル: Tinkering.cs プロジェクト: FreeReign/Rebirth-Repack
 public TrapTarget( TrapType type, TinkeringSystem sys )
     : base(10, false, TargetFlags.None)
 {
     m_Sys = sys;
     m_Type = type;
     m_End = true;
 }
コード例 #42
0
        public virtual bool ExecuteTrap( Mobile from )
        {
            if ( m_TrapType != TrapType.None )
            {
                Point3D loc = this.GetWorldLocation();
                Map facet = this.Map;

                if ( from.AccessLevel >= AccessLevel.GameMaster )
                {
                    SendMessageTo( from, "That is trapped, but you open it with your godly powers.", 0x3B2 );
                    return false;
                }

                switch ( m_TrapType )
                {
                    case TrapType.ExplosionTrap:
                    {
                        SendMessageTo( from, 502999, 0x3B2 ); // You set off a trap!

                        if ( from.InRange( loc, 3 ) )
                        {
                            int damage;

                            if ( m_TrapLevel > 0 )
                                damage = Utility.RandomMinMax( 10, 30 ) * m_TrapLevel;
                            else
                                damage = m_TrapPower;

                            AOS.Damage( from, damage, 0, 100, 0, 0, 0 );

                            // Your skin blisters from the heat!
                            from.LocalOverheadMessage( Network.MessageType.Regular, 0x2A, 503000 );
                        }

                        Effects.SendLocationEffect( loc, facet, 0x36BD, 15, 10 );
                        Effects.PlaySound( loc, facet, 0x307 );

                        break;
                    }
                    case TrapType.MagicTrap:
                    {
                        if ( from.InRange( loc, 1 ) )
                            from.Damage( m_TrapPower );
                            //AOS.Damage( from, m_TrapPower, 0, 100, 0, 0, 0 );

                        Effects.PlaySound( loc, Map, 0x307 );

                        Effects.SendLocationEffect( new Point3D( loc.X - 1, loc.Y, loc.Z ), Map, 0x36BD, 15 );
                        Effects.SendLocationEffect( new Point3D( loc.X + 1, loc.Y, loc.Z ), Map, 0x36BD, 15 );

                        Effects.SendLocationEffect( new Point3D( loc.X, loc.Y - 1, loc.Z ), Map, 0x36BD, 15 );
                        Effects.SendLocationEffect( new Point3D( loc.X, loc.Y + 1, loc.Z ), Map, 0x36BD, 15 );

                        Effects.SendLocationEffect( new Point3D( loc.X + 1, loc.Y + 1, loc.Z + 11 ), Map, 0x36BD, 15 );

                        break;
                    }
                    case TrapType.DartTrap:
                    {
                        SendMessageTo( from, 502999, 0x3B2 ); // You set off a trap!

                        if ( from.InRange( loc, 3 ) )
                        {
                            int damage;

                            if ( m_TrapLevel > 0 )
                                damage = Utility.RandomMinMax( 5, 15 ) * m_TrapLevel;
                            else
                                damage = m_TrapPower;

                            AOS.Damage( from, damage, 100, 0, 0, 0, 0 );

                            // A dart imbeds itself in your flesh!
                            from.LocalOverheadMessage( Network.MessageType.Regular, 0x62, 502998 );
                        }

                        Effects.PlaySound( loc, facet, 0x223 );

                        break;
                    }
                    case TrapType.PoisonTrap:
                    {
                        SendMessageTo( from, 502999, 0x3B2 ); // You set off a trap!

                        if ( from.InRange( loc, 3 ) )
                        {
                            Poison poison;

                            if ( m_TrapLevel > 0 )
                            {
                                poison = Poison.GetPoison( Math.Max( 0, Math.Min( 4, m_TrapLevel - 1 ) ) );
                            }
                            else
                            {
                                AOS.Damage( from, m_TrapPower, 0, 0, 0, 100, 0 );
                                poison = Poison.Greater;
                            }

                            from.ApplyPoison( from, poison );

                            // You are enveloped in a noxious green cloud!
                            from.LocalOverheadMessage( Network.MessageType.Regular, 0x44, 503004 );
                        }

                        Effects.SendLocationEffect( loc, facet, 0x113A, 10, 20 );
                        Effects.PlaySound( loc, facet, 0x231 );

                        break;
                    }
                    case TrapType.DyeTrap:
                    {
                        from.SendMessage( "A dye pack explodes, covering your face and hair." );
                        from.HueMod = 298;
                        from.HairHue = 298;
                        break;
                    }
                }

                m_TrapType = TrapType.None;
                m_TrapPower = 0;
                m_TrapLevel = 0;
                return true;
            }

            return false;
        }
コード例 #43
0
        public override void Initialise()
        {
            if (!initialised)
            {
                roomTrapType = (TrapType)(Utility.Instance.cRand.NextDouble() * (int)TrapType.MAX_TRAPS);
                Console.WriteLine("Trap type: " + roomTrapType.ToString());

                if (!defeated)
                {
                    double enemyBuffChance = Utility.Instance.cRand.NextDouble();
                    int numMonsters = (int)(Utility.Instance.cRand.NextDouble() * maxMonsters);
                    if (roomTrapType == TrapType.INCR_NUM_ENEMIES)
                    {
                        numMonsters *= 2;
                    }
                    else if (roomTrapType == TrapType.DECR_NUM_ENEMIES)
                    {
                        numMonsters = numMonsters == 0 ? 1 : numMonsters / 2;
                    }

                    if (numMonsters == 0)
                    {
                        numMonsters = 1;
                    }

                    for (int i = 0; i < numMonsters; ++i)
                    {
                        //increased values
                        Enemy t = null;
                        double typeChance = Utility.Instance.cRand.NextDouble();

                        //pursuer
                        if (typeChance >= 0 && typeChance < 0.2)
                        {
                            t = new Pursuer(new Vector2((float)(250 + Utility.Instance.cRand.NextDouble() * (Utility.Instance.ScreenWidth - 500)), (float)(250 + Utility.Instance.cRand.NextDouble() * (Utility.Instance.ScreenHeight - 500))), new Vector2(32), Color.Yellow);
                        }
                        else if (typeChance >= 0.2 && typeChance < 0.4)
                        {
                            t = new PursuingShooter(new Vector2((float)(250 + Utility.Instance.cRand.NextDouble() * (Utility.Instance.ScreenWidth - 500)), (float)(250 + Utility.Instance.cRand.NextDouble() * (Utility.Instance.ScreenHeight - 500))), new Vector2(32), Color.Yellow);
                        }
                        else if (typeChance >= 0.4 && typeChance < 0.6)
                        {
                            t = new Avoider(new Vector2((float)(250 + Utility.Instance.cRand.NextDouble() * (Utility.Instance.ScreenWidth - 500)), (float)(250 + Utility.Instance.cRand.NextDouble() * (Utility.Instance.ScreenHeight - 500))), new Vector2(32), Color.Yellow);
                        }
                        else if (typeChance >= 0.6 && typeChance < 0.8)
                        {
                            t = new EvadingShooter(new Vector2((float)(250 + Utility.Instance.cRand.NextDouble() * (Utility.Instance.ScreenWidth - 500)), (float)(250 + Utility.Instance.cRand.NextDouble() * (Utility.Instance.ScreenHeight - 500))), new Vector2(32), Color.Yellow);
                        }
                        else if (typeChance >= 0.8 && typeChance < 1)
                        {
                            t = new Shooter(new Vector2((float)(250 + Utility.Instance.cRand.NextDouble() * (Utility.Instance.ScreenWidth - 500)), (float)(250 + Utility.Instance.cRand.NextDouble() * (Utility.Instance.ScreenHeight - 500))), new Vector2(32), Color.Yellow);
                        }

                        if (enemyBuffChance > 0.5)
                        {
            #if DEBUG
                            enemyBuffed = true;
            #endif
                            Console.WriteLine("ENEMY GETS BUFFED");
                            switch (roomTrapType)
                            {
                                case TrapType.INCR_ATTACK_DAMAGE:
                                    t.IncreaseAttackDamage();
                                    t.IncreaseAttackDamage();
                                    t.IncreaseAttackDamage();
                                    break;
                                case TrapType.INCR_ATTACK_SPEED:
                                    t.IncreaseAttackSpeed();
                                    t.IncreaseAttackSpeed();
                                    t.IncreaseAttackSpeed();
                                    break;
                                case TrapType.INCR_BULLET_SIZE:
                                    t.IncreaseBulletSize();
                                    t.IncreaseBulletSize();
                                    t.IncreaseBulletSize();
                                    break;
                                case TrapType.INCR_MOVEMENT_SPEED:
                                    t.IncreaseMovementSpeed();
                                    t.IncreaseMovementSpeed();
                                    t.IncreaseMovementSpeed();
                                    break;
                                case TrapType.INCR_HEALTH:
                                    t.IncreaseMaxHealth();
                                    t.IncreaseMaxHealth();
                                    break;
                                default: break;
                            }
                        }

                        Console.WriteLine("Adding: " + t.GetType().ToString());
                        enemies.Add(t);
                    }

                    //player gets buffed instead
                    if (enemyBuffChance <= 0.5)
                    {
            #if DEBUG
                        enemyBuffed = false;
            #endif
                        Console.WriteLine("PLAYER GETS BUFFED");
                        Dungeon.GetPlayer.SaveStats();
                        switch (roomTrapType)
                        {
                            case TrapType.INCR_ATTACK_DAMAGE:
                                Dungeon.GetPlayer.IncreaseAttackDamage();
                                Dungeon.GetPlayer.IncreaseAttackDamage();
                                Dungeon.GetPlayer.IncreaseAttackDamage();
                                break;
                            case TrapType.INCR_ATTACK_SPEED:
                                Dungeon.GetPlayer.IncreaseAttackSpeed();
                                Dungeon.GetPlayer.IncreaseAttackSpeed();
                                Dungeon.GetPlayer.IncreaseAttackSpeed();
                                break;
                            case TrapType.INCR_BULLET_SIZE:
                                Dungeon.GetPlayer.IncreaseBulletSize();
                                Dungeon.GetPlayer.IncreaseBulletSize();
                                Dungeon.GetPlayer.IncreaseBulletSize();
                                break;
                            case TrapType.INCR_MOVEMENT_SPEED:
                                Dungeon.GetPlayer.IncreaseMovementSpeed();
                                Dungeon.GetPlayer.IncreaseMovementSpeed();
                                Dungeon.GetPlayer.IncreaseMovementSpeed();
                                break;
                            case TrapType.INCR_HEALTH:
                                Dungeon.GetPlayer.IncreaseMaxHealth();
                                Dungeon.GetPlayer.IncreaseMaxHealth();
                                break;
                            default: break;
                        }
                    }
                }
            }

            base.Initialise();
        }
コード例 #44
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 3:
                {
                    m_Trapped = reader.ReadBool();

                    goto case 2;
                }
                case 2:
                {
                    m_Trapper = World.FindMobile( (Serial)reader.ReadInt() );

                    goto case 1;
                }
                case 1:
                {
                    m_TrapPower = reader.ReadInt();

                    goto case 0;
                }

                case 0:
                {
                    m_TrapType = (TrapType)reader.ReadInt();

                    break;
                }
            }

            if ( version < 3 )
                m_Trapped = m_TrapType != TrapType.None;
        }
コード例 #45
0
        public virtual bool ExecuteTrap( Mobile from )
        {
            if ( m_TrapType != TrapType.None )
            {
                Point3D loc = this.GetWorldLocation();
                Map facet = this.Map;

                Mobile parent = this.RootParent as Mobile;

                if ( from.AccessLevel >= AccessLevel.GameMaster )
                {
                    SendMessageTo( from, "That is trapped, but you open it with your godly powers.", 0x3B2 );
                    return false;
                }

                // don't execute traps in safe zones
                if (m_TrapType != TrapType.MagicTrap && from.Map != null)
                {
                    Engines.ConPVP.SafeZone sz = (Engines.ConPVP.SafeZone)Region.Find(from.Location, from.Map).GetRegion(typeof(Engines.ConPVP.SafeZone));
                    if (sz != null)
                        return true;
                }

                switch ( m_TrapType )
                {
                    case TrapType.ExplosionTrap:
                    {
                        SendMessageTo( from, 502999, 0x3B2 ); // You set off a trap!

                        if ( from.InRange( loc, 3 ) )
                        {
                            int damage;

                            if ( m_TrapLevel > 0 )
                                damage = Utility.RandomMinMax( 10, 30 ) * m_TrapLevel;
                            else
                                damage = m_TrapPower;

                            if (parent != null && parent != from)
                            {
                                AOS.Damage(parent, damage / 2, 0, 100, 0, 0, 0);
                                parent.LocalOverheadMessage(Network.MessageType.Regular, 0x2A, 503000); // Your skin blisters from the heat!
                            }

                            AOS.Damage(from, damage, 0, 100, 0, 0, 0);
                            from.LocalOverheadMessage(Network.MessageType.Regular, 0x2A, 503000); // Your skin blisters from the heat!
                        }

                        Effects.SendLocationEffect( loc, facet, 0x36BD, 15, 10 );
                        Effects.PlaySound( loc, facet, 0x307 );

                        break;
                    }
                    case TrapType.MagicTrap:
                    {
                        if ( from.InRange( loc, 1 ) )
                            from.Damage( m_TrapPower );
                            //AOS.Damage( from, m_TrapPower, 0, 100, 0, 0, 0 );

                        Effects.PlaySound( loc, Map, 0x307 );

                        Effects.SendLocationEffect( new Point3D( loc.X - 1, loc.Y, loc.Z ), Map, 0x36BD, 15 );
                        Effects.SendLocationEffect( new Point3D( loc.X + 1, loc.Y, loc.Z ), Map, 0x36BD, 15 );

                        Effects.SendLocationEffect( new Point3D( loc.X, loc.Y - 1, loc.Z ), Map, 0x36BD, 15 );
                        Effects.SendLocationEffect( new Point3D( loc.X, loc.Y + 1, loc.Z ), Map, 0x36BD, 15 );

                        Effects.SendLocationEffect( new Point3D( loc.X + 1, loc.Y + 1, loc.Z + 11 ), Map, 0x36BD, 15 );

                        break;
                    }
                    case TrapType.DartTrap:
                    {
                        SendMessageTo( from, 502999, 0x3B2 ); // You set off a trap!

                        if ( from.InRange( loc, 3 ) )
                        {
                            int damage;

                            if ( m_TrapLevel > 0 )
                                damage = Utility.RandomMinMax( 5, 15 ) * m_TrapLevel;
                            else
                                damage = m_TrapPower;

                            AOS.Damage( from, damage, 100, 0, 0, 0, 0 );

                            // A dart imbeds itself in your flesh!
                            from.LocalOverheadMessage( Network.MessageType.Regular, 0x62, 502998 );
                        }

                        Effects.PlaySound( loc, facet, 0x223 );

                        break;
                    }
                    case TrapType.PoisonTrap:
                    {
                        SendMessageTo( from, 502999, 0x3B2 ); // You set off a trap!

                        if ( from.InRange( loc, 3 ) )
                        {
                            Poison poison;

                            if ( m_TrapLevel > 0 )
                            {
                                poison = Poison.GetPoison( Math.Max( 0, Math.Min( 4, m_TrapLevel - 1 ) ) );
                            }
                            else
                            {
                                AOS.Damage( from, m_TrapPower, 0, 0, 0, 100, 0 );
                                poison = Poison.Greater;
                            }

                            if (parent != null && parent != from)
                            {
                                parent.ApplyPoison( from, poison );
                                parent.LocalOverheadMessage(Network.MessageType.Regular, 0x44, 503004); // You are enveloped in a noxious green cloud!
                            }

                            from.ApplyPoison(from, poison);
                            from.LocalOverheadMessage(Network.MessageType.Regular, 0x44, 503004); // You are enveloped in a noxious green cloud!
                        }

                        Effects.SendLocationEffect( loc, facet, 0x113A, 10, 20 );
                        Effects.PlaySound( loc, facet, 0x231 );

                        break;
                    }
                }

                m_TrapType = TrapType.None;
                m_TrapPower = 0;
                m_TrapLevel = 0;
                return true;
            }

            return false;
        }
コード例 #46
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
                case 4:
                {
                    m_Armed = reader.ReadBool();
                    goto case 3;
                }
				case 3:
				{
					m_TrapCreator = reader.ReadMobile();
					goto case 2;
				}
				case 2:
				{
					m_TrapLevel = reader.ReadInt();
					goto case 1;
				}
				case 1:
				{
					m_TrapPower = reader.ReadInt();
					goto case 0;
				}
				case 0:
				{
					m_TrapType = (TrapType)reader.ReadInt();
					break;
				}
			}
		}
コード例 #47
0
ファイル: DefTinkering.cs プロジェクト: bittiez/ServUO
        public override Item CompleteCraft(out int message)
        {
            message = this.Verify(this.Container);

            if (message == 0)
            {
                int trapLevel = (int)(this.From.Skills.Tinkering.Value / 10);

                this.Container.TrapType = this.TrapType;
                this.Container.TrapPower = trapLevel * 9;
                this.Container.TrapLevel = trapLevel;
                this.Container.TrapOnLockpick = true;

                message = 1005639; // Trap is disabled until you lock the chest.
            }

            return null;
        }
コード例 #48
0
        public void DisarmTrap(Mobile from)
        {
            SendMessageTo(from, 502999, 0x3B2); // You set off a trap!

            this.m_TrapType = TrapType.None;
            this.m_TrapPower = 0;
            this.m_TrapLevel = 0;
            TrapEnabled = false;
        }
コード例 #49
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize (reader);
            int ver = reader.ReadInt();

            switch ( ver )
            {
                case 0:
                    m_Trap1 = (TrapType)reader.ReadInt();
                    m_Trap2 = (TrapType)reader.ReadInt();
                    m_T1Pwr = reader.ReadInt();
                    m_T2Pwr = reader.ReadInt();

                    m_ExpRange = reader.ReadInt();
                    m_ExpPower = reader.ReadInt();
                    break;
            }
        }
コード例 #50
0
ファイル: BaseAI.cs プロジェクト: Shwam/MegaMinerAI-15
    /// <summary>
    /// Synchronizes with the server, then calls run().
    /// </summary>
    /// <returns>
    /// Return true to end turn, false to resynchronize with the 
    /// server and run again.
    /// </returns>
    public bool startTurn()
    {
        int count = 0;
        iteration++;

        count = Client.getPlayerCount(connection);
        players = new Player[count];
        for(int i = 0; i < count; i++)
          players[i] = new Player(Client.getPlayer(connection, i));

        count = Client.getMappableCount(connection);
        mappables = new Mappable[count];
        for(int i = 0; i < count; i++)
          mappables[i] = new Mappable(Client.getMappable(connection, i));

        count = Client.getTileCount(connection);
        tiles = new Tile[count];
        for(int i = 0; i < count; i++)
          tiles[i] = new Tile(Client.getTile(connection, i));

        count = Client.getTrapCount(connection);
        traps = new Trap[count];
        for(int i = 0; i < count; i++)
          traps[i] = new Trap(Client.getTrap(connection, i));

        count = Client.getThiefCount(connection);
        thiefs = new Thief[count];
        for(int i = 0; i < count; i++)
          thiefs[i] = new Thief(Client.getThief(connection, i));

        count = Client.getThiefTypeCount(connection);
        thiefTypes = new ThiefType[count];
        for(int i = 0; i < count; i++)
          thiefTypes[i] = new ThiefType(Client.getThiefType(connection, i));

        count = Client.getTrapTypeCount(connection);
        trapTypes = new TrapType[count];
        for(int i = 0; i < count; i++)
          trapTypes[i] = new TrapType(Client.getTrapType(connection, i));

        if(!initialized)
        {
          initialized = true;
          init();
        }

        return run();
    }
コード例 #51
0
ファイル: BaseDoor.cs プロジェクト: justdanofficial/khaeros
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            version = reader.ReadInt();

            if (version > 8)
                m_RelockOnClose = reader.ReadBool();

            if (version > 7)
                m_Picker = reader.ReadMobile();

            if( version > 6 )
                m_ClosesAutomatically = reader.ReadBool();

            m_TrapLevel = reader.ReadInt();
            m_TrapPower = reader.ReadInt();
            m_TrapType = (TrapType)reader.ReadInt();
            m_TrapOnLockpick = reader.ReadBool();
            m_RequiredSkill = reader.ReadInt();
            m_MaxLockLevel = reader.ReadInt();
            m_LockLevel = reader.ReadInt();

            m_KeyValue = reader.ReadUInt();

            m_Open = reader.ReadBool();
            m_Locked = reader.ReadBool();
            m_OpenedID = reader.ReadInt();
            m_ClosedID = reader.ReadInt();
            m_OpenedSound = reader.ReadInt();
            m_ClosedSound = reader.ReadInt();
            m_Offset = reader.ReadPoint3D();
            m_Link = reader.ReadItem() as BaseDoor;

            m_Timer = new InternalTimer( this );

            if ( m_Open && m_ClosesAutomatically )
                m_Timer.Start();

            if( this.LockLevel < 100 )
                this.LockLevel = 100;

            if( this.RequiredSkill < 100 )
                this.RequiredSkill = 100;
        }
コード例 #52
0
 // Use this for initialization
 private void Start()
 {
     this.drone = GameObject.Find("DJIPhantom").transform;
     this.traps = new Queue<TrapBase>();
     this.collectibles = new Queue<Transform>();
     this.RecalculateCollectibleCountdown();
     float offset = this.drone.position.x;
     for (int i = 0; i <= this.GenerateAheadLimit; i++)
     {
         if (this.traps.Count > 0)
         {
             if (--collectibleCountdown == 0)
             {
                 this.GenerateCollectible(offset, offset + 30);
                 this.RecalculateCollectibleCountdown();
             }
         }
         this.traps.Enqueue(this.GenerateNextTrap(offset += 30));
     }
     this.lastGeneratedTrap = TrapType.PingPongTrap;
 }
コード例 #53
0
        public virtual bool ExecuteTrap( Mobile from )
        {
            if ( m_TrapType != TrapType.None )
            {
                switch ( m_TrapType )
                {
                    case TrapType.ExplosionTrap:
                    {
                        from.SendLocalizedMessage( 502999 ); // You set off a trap!

                        if ( from.InRange( GetWorldLocation(), 2 ) )
                        {
                            AOS.Damage( from, m_TrapPower, 0, 100, 0, 0, 0 );
                            from.SendLocalizedMessage( 503000 ); // Your skin blisters from the heat!
                        }

                        Point3D loc = GetWorldLocation();

                        Effects.PlaySound( loc, Map, 0x307 );
                        Effects.SendLocationEffect( new Point3D( loc.X + 1, loc.Y + 1, loc.Z - 11 ), Map, 0x36BD, 15 );

                        break;
                    }
                    case TrapType.MagicTrap:
                    {
                        if ( from.InRange( GetWorldLocation(), 1 ) )
                            from.Damage( m_TrapPower );
                            //AOS.Damage( from, m_TrapPower, 0, 100, 0, 0, 0 );

                        Point3D loc = GetWorldLocation();

                        Effects.PlaySound( loc, Map, 0x307 );

                        Effects.SendLocationEffect( new Point3D( loc.X - 1, loc.Y, loc.Z ), Map, 0x36BD, 15 );
                        Effects.SendLocationEffect( new Point3D( loc.X + 1, loc.Y, loc.Z ), Map, 0x36BD, 15 );

                        Effects.SendLocationEffect( new Point3D( loc.X, loc.Y - 1, loc.Z ), Map, 0x36BD, 15 );
                        Effects.SendLocationEffect( new Point3D( loc.X, loc.Y + 1, loc.Z ), Map, 0x36BD, 15 );

                        Effects.SendLocationEffect( new Point3D( loc.X + 1, loc.Y + 1, loc.Z + 11 ), Map, 0x36BD, 15 );

                        break;
                    }
                    case TrapType.DartTrap:
                    {
                        AOS.Damage( from, m_TrapPower, 100, 0, 0, 0, 0 );

                        Effects.SendMovingEffect( this, from, 0x1BFE, 7, 0, false, false );
                        Effects.PlaySound( from.Location, from.Map, 0x234 );
                        break;
                    }
                    case TrapType.PoisonTrap:
                    {
                        AOS.Damage( from, m_TrapPower, 0, 0, 0, 100, 0 );

                        from.Poison = Poison.Greater;

                        Point3D loc = GetWorldLocation();
                        Effects.PlaySound( loc, Map, 0x1DE );
                        Effects.SendLocationEffect( new Point3D( from.Location.X + 1, from.Location.Y + 1, from.Location.Z + 15 ), from.Map, 0x11A6, 48 );
                        break;
                    }
                }

                m_TrapType = TrapType.None;
                return true;
            }

            return false;
        }
コード例 #54
0
ファイル: GameObject.cs プロジェクト: SamuelDaigle/MapEditor
 /// <summary>
 /// Gets the path of the trap type.
 /// </summary>
 /// <param name="val">The value.</param>
 /// <returns></returns>
 public static string ToDescriptionString(TrapType val)
 {
     DescriptionAttribute[] attributes = (DescriptionAttribute[])val.GetType().GetField(val.ToString()).GetCustomAttributes(typeof(DescriptionAttribute), false);
     return attributes.Length > 0 ? attributes[0].Description : string.Empty;
 }
コード例 #55
0
 private TrapBase GenerateNextTrap(float offset)
 {
     int length = Enum.GetValues(typeof(TrapType)).Length;
     var randomType = (TrapType)Random.Range(0, length);
     if (randomType == this.lastGeneratedTrap)
     {
         if ((int)randomType <= 3)
             randomType = (TrapType)(((int)randomType + 4) % length);
         else
             randomType = (TrapType)(((int)randomType + 1) % length);
     }
     this.lastGeneratedTrap = randomType;
     switch (randomType)
     {
         case TrapType.HorizontalLaserTrap:
             return new HorizontalLaserTrap(offset, this.LaserPrefab, 0.5f);
         case TrapType.DiamondLaserTrap:
             return new DiamondLaserTrap(offset, this.LaserPrefab, 0.5f);
         case TrapType.HorizontalMovingLaserTrap:
             return new HorizontalMovingLaserTrap(offset, this.LaserPrefab, 0.25f, Random.Range(0.02f, 0.05f), Random.Range(0, 2) == 1); //TODO: da bude brze sa vremenom
         case TrapType.VerticalColumnTrap:
             return new VerticalColumnTrap(offset, Random.Range((-TerrainGenerator.roadwayWidth / 2) * 0.5f, TerrainGenerator.roadwayWidth / 2) * 0.5f);
         case TrapType.MovingWallTrap:
             return new MovingWallTrap(offset, Random.Range(0, 2) == 1);
         case TrapType.DroneArmyTrap:
             return new DroneArmyTrap(offset, this.DroneSoldierPrefab, DroneArmyTrap.FormationType.DeathJaws);
         case TrapType.PingPongTrap:
             return new PingPongTrap(offset, Random.Range(0, 4));
         default:
             return null;
     }
 }
コード例 #56
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
				case 5:
				{
					// removed the deco field (case 3)
					goto case 4;
				}
				case 4:
				{
					m_Enabled = reader.ReadBool();

					goto case 3;
				}
				case 3:
				{	// obsolete deco field
					bool dummy;
					if (version < 5)
						dummy = reader.ReadBool();
					goto case 2;
				}
				case 2:
				{
					m_TinkerMade = reader.ReadBool();
					m_LastTrapType = (TrapType)reader.ReadInt();

					goto case 1;
				}
				case 1:
				{
					m_TrapPower = reader.ReadInt();

					goto case 0;
				}

				case 0:
				{
					m_TrapType = (TrapType)reader.ReadInt();

					break;
				}
			}
		}
コード例 #57
0
		public virtual bool ExecuteTrap( Mobile from )
		{
			//Pix: have staff be able to open container w/o tripping trap
			if( from.AccessLevel > AccessLevel.Player ) return false;

			if ( m_TrapType != TrapType.None && m_Enabled && CanDetonate(from) )
			{
				m_LastTrapType = m_TrapType;
				switch ( m_TrapType )
				{
					case TrapType.ExplosionTrap:
					{
						from.SendLocalizedMessage( 502999 ); // You set off a trap!

						if ( from.InRange( GetWorldLocation(), 2 ) )
						{
							AOS.Damage( from, m_TrapPower, 0, 100, 0, 0, 0 );
							from.SendLocalizedMessage( 503000 ); // Your skin blisters from the heat!
						}

						Point3D loc = GetWorldLocation();

						Effects.PlaySound( loc, Map, 0x307 );
						//Effects.SendLocationEffect( new Point3D( loc.X + 1, loc.Y + 1, loc.Z - 11 ), Map, 0x36BD, 15 );
						Effects.SendLocationEffect(loc, Map, 0x36BD, 15, 10);

						break;
					}
					case TrapType.MagicTrap:
					{
						if ( from.InRange( GetWorldLocation(), 1 ) )
							AOS.Damage( from, m_TrapPower, 0, 100, 0, 0, 0 );

						Point3D loc = GetWorldLocation();

						Effects.PlaySound( loc, Map, 0x307 );

						Effects.SendLocationEffect( new Point3D( loc.X - 1, loc.Y, loc.Z ), Map, 0x36BD, 15 );
						Effects.SendLocationEffect( new Point3D( loc.X + 1, loc.Y, loc.Z ), Map, 0x36BD, 15 );

						Effects.SendLocationEffect( new Point3D( loc.X, loc.Y - 1, loc.Z ), Map, 0x36BD, 15 );
						Effects.SendLocationEffect( new Point3D( loc.X, loc.Y + 1, loc.Z ), Map, 0x36BD, 15 );

						Effects.SendLocationEffect( new Point3D( loc.X + 1, loc.Y + 1, loc.Z + 11 ), Map, 0x36BD, 15 );

						break;
					}
					case TrapType.DartTrap:
					{
						from.SendLocalizedMessage( 502999 ); // You set off a trap!

						if ( from.InRange( GetWorldLocation(), 2 ) )
						{
							AOS.Damage( from, m_TrapPower/2, 100, 0, 0, 0, 0 );
							from.SendLocalizedMessage( 502380 ); // A dart embeds...
						}

						Point3D loc = GetWorldLocation();

						Effects.PlaySound( loc, Map, 0x223 );
						//What effect?!?
						//Effects.SendLocationEffect( new Point3D( loc.X + 1, loc.Y + 1, loc.Z - 11 ), Map, 0x36BD, 15 );
						break;
					}
					case TrapType.PoisonTrap:
					{
						from.SendLocalizedMessage( 502999 ); // You set off a trap!

						if ( from.InRange( GetWorldLocation(), 2 ) )
						{
							Poison p = Poison.Lesser;
							if( m_TrapPower >= 30 )
								p = Poison.Regular;
							if( m_TrapPower >= 60 )
								p = Poison.Greater;
							if( m_TrapPower >= 90 )
								p = Poison.Deadly;
							if( m_TrapPower >= 100 )
								p = Poison.Lethal;

							from.ApplyPoison( from, p );
							from.SendLocalizedMessage( 503004 ); // You are enveloped...
						}

						Point3D loc = GetWorldLocation();

						Effects.PlaySound( loc, Map, 0x231 );
						//Effects.SendLocationEffect( new Point3D( loc.X + 1, loc.Y + 1, loc.Z - 11 ), Map, 0x11A6, 20 ); 
						Effects.SendLocationEffect(new Point3D(loc.X + 1, loc.Y + 1, loc.Z + 1), Map, 0x113A, 10, 20); 
						//Effects.SendLocationEffect(loc, Map, 0x113A, 10, 20);
						break;
					}
				}

				m_TrapType = TrapType.None;
				return true;
			}

			return false;
		}
コード例 #58
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 3:
                {
                    m_TrapLevel = reader.ReadInt();
                    goto case 2;
                }
                // ***
            case 2:
                {
                    m_PlayerTrap = reader.ReadBool();
                    m_TrapActive = reader.ReadBool();
                    goto case 1;
                }
                    // ***
                case 1:
                {
                    m_TrapPower = reader.ReadInt();
                    goto case 0;
                }
                case 0:
                {
                    m_TrapType = (TrapType)reader.ReadInt();
                    break;
                }
            }
        }
コード例 #59
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 2:
                {
                    m_TrapLevel = reader.ReadInt();
                    goto case 1;
                }
                case 1:
                {
                    m_TrapPower = reader.ReadInt();
                    goto case 0;
                }
                case 0:
                {
                    m_TrapType = (TrapType)reader.ReadInt();
                    break;
                }
            }
        }
コード例 #60
0
    public void SetTileInfo(TileType tileType, TrapType trapType, int index)
    {
        _tileType = tileType;
        _trapType = trapType;
        _index = index;

        switch(tileType)
        {
        case TileType.HealthShrine:
            _monsterObj.transform.Find("ShrineEffect").GetComponent<ParticleSystem>().startColor = Color.red;
            break;

        case TileType.ManaShrine:
            _monsterObj.transform.Find("ShrineEffect").GetComponent<ParticleSystem>().startColor = Color.blue;
            break;

        case TileType.CriticalShrine:
            _monsterObj.transform.Find("ShrineEffect").GetComponent<ParticleSystem>().startColor = Color.yellow;
            break;
        }
    }