상속: NetworkBehaviour
        public async Task <IActionResult> Edit(int id, [Bind("Stealthid,Stealthprof")] Stealth stealth)
        {
            if (id != stealth.Stealthid)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(stealth);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StealthExists(stealth.Stealthid))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(stealth));
        }
예제 #2
0
 public override void setup(GameObject GO)
 {
     if (stealth)
     {
         Stealth stel = GO.AddComponent <Stealth>();
         stel.invismat = stealthMat;
         stel.GoDark();
     }
     if (Chain)
     {
         if (!GameMaster.instance.CM.active)
         {
             GameMaster.instance.CM.ChainStart(chainLnegth, Bonus, GO);
             if (GO.GetComponent <FoodData>() != null)
             {
                 GO.GetComponent <FoodData>().chained = true;
             }
         }
         //GameMaster.instance.CM.ChainRequest(GO, this);
         // ask chainmanger
         //if false do not add chain script to gameobject
     }
     else if (!Special())
     {
         if (GameMaster.instance.CM.ChainRequest(GO))
         {
             GO.GetComponent <FoodData>().Chain();
         }
     }
     base.setup(GO);
     //apply special conditions
 }
예제 #3
0
        public void Large_NoSizeBonus_NoPenalty()
        {
            // Arrange
            var dexterity = Mock.Of <IAbilityScore>();

            var mockAbilityScores = new Mock <IAbilityScoreSection>();

            mockAbilityScores.Setup(abs => abs.Dexterity)
            .Returns(dexterity);

            var mockCharacter = new Mock <ICharacter>();

            mockCharacter.Setup(c => c.AbilityScores)
            .Returns(mockAbilityScores.Object);
            mockCharacter.Setup(c => c.Size)
            .Returns(SizeCategory.Large);

            Stealth stealthSkill = new Stealth(mockCharacter.Object);

            // Assert
            Assert.IsTrue(stealthSkill.ArmorCheckPenaltyApplies);
            Assert.AreEqual(0, stealthSkill.SizeBonuses.GetTotal());
            Assert.AreEqual(4, stealthSkill.Penalties.GetTotal(),
                            "Large characters have a -4 penalty on Stealth checks.");
        }
예제 #4
0
        private void Stealth(NecClient client, int skillId)
        {
            // I am doing this from memory, it could very well be wrong  :)
            // Not blocking any actions if stealthed.
            // Stealth will be turned off if start casting another skill or damage is done.

            int     errorCode = 0;
            Stealth stealth   = new Stealth(_server, client, skillId);

            server.instances.AssignInstance(stealth);
            client.character.activeSkillInstance = stealth.instanceId;
            if (!_server.settingRepository.skillBase.TryGetValue(skillId, out SkillBaseSetting skillBaseSetting))
            {
                _Logger.Error($"Getting SkillBaseSetting from skillid [{skillId}]");
                errorCode = -1;
                RecvSkillStartCastR startFail = new RecvSkillStartCastR(errorCode, 0.0F);
                router.Send(startFail, client);
                return;
            }

            RecvSkillStartCastR skillFail = new RecvSkillStartCastR(errorCode, skillBaseSetting.castingTime);

            router.Send(skillFail, client);
            stealth.StartCast();
        }
예제 #5
0
	void Awake()
	{
		bulletHitParticlesPooler = GameObject.Find("Bullet Hit Particles").GetComponent<ObjectPoolerScript>();

		if (playerControlled) 
		{
		} 
		else 
		{
			soldierScript = GetComponentInParent<Soldier>();
		}
		audioSource = GetComponent<AudioSource> ();
		gunLine = GetComponent<LineRenderer> ();
		targetCircle = GameObject.Find("circle (outline)").transform;

		timer = 60/firingRPM;
		if (timer > 0.2f)
			effectsDisplayTime = 0.2f;
		else
			effectsDisplayTime = timer-0.1f;

		if(!hasLaser)
		{
			try{	transform.parent.FindChild("Laser").gameObject.SetActive(false);}catch{}
		}

		stealthScript = GameObject.FindGameObjectWithTag ("GameController").GetComponent<Stealth> ();
		shootNoise = audioSource.clip;
	}
예제 #6
0
    public void OnStartStrangle()
    {
        if (_strangleTarget == null)
        {
            MyAnimator.SetTrigger("CancelBite");
            MyAnimEventHandler.TriggerOnEndStrangle();
            return;
        }

        Character target = _strangleTarget;

        target.SendCommand(CharacterCommands.Idle);
        target.SendCommand(CharacterCommands.StopAim);
        target.IsBodyLocked = true;



        //align enemy facing direction to player's
        Vector3 lineOfSight = target.transform.position - transform.position;

        lineOfSight = new Vector3(lineOfSight.x, 0, lineOfSight.z);
        Quaternion rotation = Quaternion.LookRotation(lineOfSight);

        target.transform.rotation = rotation;
        target.MyAnimator.SetTrigger("GetStrangled");
        target.MyStatus.AddBleeding(0.5f);


        Stealth.SetNoiseLevel(10, 0.8f);
    }
예제 #7
0
        public void Target(IPoint3D p)
        {
            IPoint3D orig = p;
            Map      map  = Caster.Map;

            SpellHelper.GetSurfaceTop(ref p);

            Point3D from = Caster.Location;
            Point3D to   = new Point3D(p);

            PlayerMobile pm = Caster as PlayerMobile; // IsStealthing should be moved to Server.Mobiles

            if (!pm.IsStealthing)
            {
                Caster.SendLocalizedMessage(1063087); // You must be in stealth mode to use this ability.
            }
            else if (Sigil.ExistsOn(Caster))
            {
                Caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil.
            }
            else if (WeightOverloading.IsOverloaded(Caster))
            {
                Caster.SendLocalizedMessage(502359, "", 0x22); // Thou art too encumbered to move.
            }
            else if (!SpellHelper.CheckTravel(Caster, TravelCheckType.TeleportFrom) ||
                     !SpellHelper.CheckTravel(Caster, map, to, TravelCheckType.TeleportTo))
            {
            }
            else if (map?.CanSpawnMobile(p.X, p.Y, p.Z) != true)
            {
                Caster.SendLocalizedMessage(502831); // Cannot teleport to that spot.
            }
            else if (SpellHelper.CheckMulti(to, map, true, 5))
            {
                Caster.SendLocalizedMessage(502831); // Cannot teleport to that spot.
            }
            else if (Region.Find(to, map).IsPartOf <HouseRegion>())
            {
                Caster.SendLocalizedMessage(502829); // Cannot teleport to that spot.
            }
            else if (CheckSequence())
            {
                SpellHelper.Turn(Caster, orig);

                Mobile m = Caster;

                m.Location = to;
                m.ProcessDelta();

                Effects.SendLocationParticles(EffectItem.Create(from, m.Map, EffectItem.DefaultDuration), 0x3728, 10, 10,
                                              2023);

                m.PlaySound(0x512);

                Stealth.OnUse(m); // stealth check after the a jump
            }

            FinishSequence();
        }
예제 #8
0
 void Start()
 {
     gravity      = Physics2D.gravity.y;
     inAir        = false;
     stealthUI    = gameObject.GetComponent <Stealth>();
     jumpsInTotal = 0;
     normalSpeed  = movementSpeed;
 }
예제 #9
0
 public void locatedStealth(Stealth m_detectedStealth,float m_levelOfDetection)
 {
     m_levelOfDetection = Mathf.Clamp(m_levelOfDetection,0,1);
     if(m_levelOfDetection > levelOfDetection){
         detectedStealth = m_detectedStealth;
         levelOfDetection = m_levelOfDetection;
         m_detectedStealth.wasDetected(this);
     }
 }
예제 #10
0
        public void ShouldReturnName()
        {
            //assign
            ISkill actualSkillBase = new Stealth();
            //act
            ITextObj name = actualSkillBase.Name();

            //assert
            name.Should().Be(new TextObj("Stealth"));
        }
예제 #11
0
        public void Bonus_StealthSpecified_ShouldWork()
        {
            SetupCharacter();

            Skills stealth = new Stealth(true, true);

            Assert.AreEqual(-5, stealth.Bonus);
            Assert.IsTrue(stealth.Proficiency);
            Assert.IsTrue(stealth.Expertise);
        }
예제 #12
0
 public void locatedStealth(Stealth m_detectedStealth, float m_levelOfDetection)
 {
     m_levelOfDetection = Mathf.Clamp(m_levelOfDetection, 0, 1);
     if (m_levelOfDetection > levelOfDetection)
     {
         detectedStealth  = m_detectedStealth;
         levelOfDetection = m_levelOfDetection;
         m_detectedStealth.wasDetected(this);
     }
 }
예제 #13
0
        public void ShouldReturnBaseAttribute()
        {
            //arrange
            ISkill skill = new Stealth();
            ICharacterAttribute dexterityAttribute = new DexterityAttribute();
            //act
            ICharacterAttribute actualAttribute = skill.BaseAttribute();

            //assert
            actualAttribute.Should().Be(dexterityAttribute);
        }
        public async Task <IActionResult> Create([Bind("Stealthid,Stealthprof")] Stealth stealth)
        {
            if (ModelState.IsValid)
            {
                _context.Add(stealth);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(stealth));
        }
예제 #15
0
 // Start is called before the first frame update
 void Start()
 {
     for (int i = 0; i < recentCheckpoint.Length; i++)
     {
         recentCheckpoint[i] = new Vector3(1000, 1000, 0);
     }
     player = GameObject.FindGameObjectWithTag("Player");
     playerStealthScript             = player.GetComponent <Stealth>();
     recentCheckpoint[checkpointNum] = player.transform.position;
     checkpointNum++;
 }
예제 #16
0
        public void ShouldReturnBonusOfBaseAttribute()
        {
            //arrange
            DexterityAttribute dexterityAttribute = new DexterityAttribute(new AttributeScore(14));
            ISkill             stealth            = new Stealth(dexterityAttribute);
            IAttributeScore    expectedScore      = new AttributeScore(2);
            //act
            IAttributeScore actualScore = stealth.SkillBonus();

            //assert
            actualScore.Should().Be(expectedScore);
        }
예제 #17
0
    void Start()
    {
        gravity      = Physics2D.gravity.y;
        stealthUI    = gameObject.GetComponent <Stealth>();
        jumpsInTotal = 0;
        normalSpeed  = movementSpeed;

        //lastPos.y = transform.position.y;
        //InvokeRepeating("GetPos", 0.7f, 0.3f);
        //health *= 100;
        //load.LoadData();
        ani.SetBool("isDead", isDead);
    }
예제 #18
0
    // Start is called before the first frame update
    void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player");
        playerMovementScript = player.GetComponent <PlayerMovement>();
        playerStealthScript  = player.GetComponent <Stealth>();
        cam = GameObject.FindGameObjectWithTag("MainCamera");

        skillCanvas = GameObject.Find("SkillCanvas");
        if (skillCanvas != null)
        {
            skillCanvas.SetActive(false);
        }
    }
예제 #19
0
        internal void Connect()
        {
            Stealth.AddTraceMessage(string.Format("Connect Stealth client. Host: {0}, Port: {1}", _host, _port),
                                    "Stealth.Network");
            _client = new TcpClient(_host, _port);
            _reader = new BinaryReader(_client.GetStream());
            _writer = new BinaryWriter(_client.GetStream());

            Stealth.AddTraceMessage("Start reciever", "Stealth.Network");
            var factory = new TaskFactory(_cts.Token, TaskCreationOptions.LongRunning,
                                          TaskContinuationOptions.LongRunning, TaskScheduler.Default);

            factory.StartNew(Receiver, _cts.Token);
        }
예제 #20
0
    // Use this for initialization
    void Start()
    {
        eye          = GameObject.FindGameObjectWithTag("Eye");
        civilian     = this.gameObject;
        nav          = civilian.GetComponent <NavMeshAI>();
        civTransform = civilian.transform;
        index        = civTransform.GetSiblingIndex();

        //Don't run the Update() method if the NPC is an Android
        //       if (!isAndroid)
        //       {
        stealthScript = eye.GetComponent <Stealth>();
        //       }
        coroutine = WaitforPauseMenu();
    }
예제 #21
0
 public static void mod_ChangeLevel(MapData map)
 {
     if (IEModOptions.SaveBeforeTransition)             // added this block
     {
         AutosaveIfAllowed();
     }
     try
     {
         foreach (PartyMemberAI rai in PartyMemberAI.PartyMembers)
         {
             if (rai != null)
             {
                 if (rai.StateManager != null)
                 {
                     AIState currentState = rai.StateManager.CurrentState;
                     if (currentState != null)
                     {
                         currentState.StopMover();
                     }
                     rai.StateManager.AbortStateStack();
                 }
                 Stealth component = rai.GetComponent <Stealth>();
                 if (component)
                 {
                     component.ClearAllSuspicion();
                 }
             }
         }
         StartPoint.s_ChosenStartPoint = null;
         BeginLevelUnload(map.SceneName);
         ConditionalToggleManager.Instance.ResetBetweenSceneLoads();
         PersistenceManager.SaveGame();
         FogOfWar.Save();
         string levelFilePath = PersistenceManager.GetLevelFilePath(map.SceneName);
         GameState.IsRestoredLevel = File.Exists(levelFilePath);
         if (GameUtilities.Instance != null)
         {
             bool loadFromSaveFile = false;
             GameUtilities.Instance.StartCoroutine(GameResources.LoadScene(map.SceneName, loadFromSaveFile));
         }
         GameState.Instance.CurrentNextMap = map;
     }
     catch (Exception exception)
     {
         Debug.LogException(exception);
     }
 }
예제 #22
0
        private void Stealth(NecClient client, int skillId, SkillBaseSetting skillBaseSetting)
        {
            float cooldown = 0.0F;

            Logger.Debug($"IsStealthed [{client.Character.IsStealthed()}]");
            if (client.Character.IsStealthed())
            {
                cooldown = skillBaseSetting.CastingCooldown;
            }
            RecvSkillExecR execSuccess = new RecvSkillExecR(0, cooldown, skillBaseSetting.RigidityTime);

            Router.Send(execSuccess, client);

            Stealth stealth = (Stealth)Server.Instances.GetInstance((uint)client.Character.activeSkillInstance);

            stealth.SkillExec();
        }
예제 #23
0
    void Start()
    {
        _characterBehavior = GetComponent <CharacterBehavior>();
        _controller        = GetComponent <CharacterBehaviorController>();
        _tank    = GetComponent <Tank>();
        _stealth = GetComponent <Stealth>();

        if (Jetpack != null)
        {
            Jetpack.enableEmission = false;
            if (_UICamera != null)
            {
                _UICamera.GetComponent <GUIManager>().SetJetpackBar(!JetpackUnlimited);
            }
            _characterBehavior.BehaviorState.JetpackFuelDurationLeft = JetpackFuelDuration;
        }
    }
    // Start is called before the first frame update
    void Start()
    {
        rb          = GetComponent <Rigidbody2D>();
        startingPos = transform.position;
        if (!verticalPatrol)
        {
            SetDirection(Vector2.right);
        }
        else
        {
            SetDirection(Vector2.up);
        }

        player = GameObject.FindGameObjectWithTag("Player");
        playerStealthScript = player.GetComponent <Stealth>();

        gameManagerScript = GameObject.Find("GameManager").GetComponent <GameManager>();
    }
예제 #25
0
        private void SendPacket(Packet packet)
        {
            while (_writer == null || !_writer.BaseStream.CanWrite)
            {
                Thread.Sleep(10);
            }

            if (Stealth.EnableTracing)
            {
                Stealth.AddTraceMessage(string.Format("Send packet. Type: {0}, Param: {1}",
                                                      packet.Method,
                                                      string.Join(",", packet.Data.Select(b => b.ToString("X2")))),
                                        "Stealth.Network");
            }
            var pb = packet.GetBytes();
            var lb = BitConverter.GetBytes(pb.Length).Reverse().ToArray();

            _writer.Write(lb);
            _writer.Write(pb);
            _writer.Flush();
        }
예제 #26
0
파일: Stats.cs 프로젝트: Monaghar/ToonWorld
 public override string ToString()
 {
     return(Acrobatics.ToString() + ' ' +
            AnimalHandling.ToString() + ' ' +
            Arcana.ToString() + ' ' +
            Athletics.ToString() + ' ' +
            Deception.ToString() + ' ' +
            History.ToString() + ' ' +
            Insight.ToString() + ' ' +
            Intimidation.ToString() + ' ' +
            Investigation.ToString() + ' ' +
            Medicine.ToString() + ' ' +
            Nature.ToString() + ' ' +
            Perception.ToString() + ' ' +
            Performance.ToString() + ' ' +
            Persusion.ToString() + ' ' +
            Religion.ToString() + ' ' +
            SleightOfHand.ToString() + ' ' +
            Stealth.ToString() + ' ' +
            Survival.ToString());
 }
예제 #27
0
    // Use this for initialization
    void Start()
    {
        NetworkAnimator netAnimator = GetComponent <NetworkAnimator>();

        for (int i = 0; i < netAnimator.animator.parameterCount; i++)
        {
            netAnimator.SetParameterAutoSend(i, true);
        }

        biteArea = transform.GetChild(2).gameObject;

        if (!this.isLocalPlayer)
        {
            return;
        }

        // Set custom attributes for class:
        PlayerEffects pe = GetComponent <PlayerEffects>();

        pe.CmdSetAttributes(1.2f, 1.2f, 1.2f, 0.8f);

        // Add abilities to class:
        PlayerAbilityManager abilityManager = GetComponent <PlayerAbilityManager>();
        Sprint sp = gameObject.AddComponent <Sprint>();

        sp.init(50, 1);
        abilityManager.abilities.Add(sp);

        Stealth st = gameObject.AddComponent <Stealth>();

        st.init(1, 0);
        abilityManager.abilities.Add(st);

        GameObject.Find("AbilityPanel").GetComponent <AbilityPanel>().setupPanel(abilityManager);

        CmdApplySmell();

        this._playerController = GetComponent <PlayerController>();
    }
예제 #28
0
        public override void OnInspectorGUI()
        {
            Stealth stealthScript = (Stealth)target;

            DrawDefaultInspector();

            //creates patrol path
            if (GUILayout.Button("Create patrol path"))
            {
                if (stealthScript.pathParent == null)
                {
                    // set up the path parent
                    stealthScript.pathParent = new GameObject();
                    stealthScript.pathParent.transform.position = stealthScript.gameObject.transform.position;
                    stealthScript.pathParent.name             = "Path Controller";
                    stealthScript.pathParent.transform.parent = stealthScript.gameObject.transform;
                    PathController controller = stealthScript.pathParent.AddComponent <PathController>();
                }

                //make the path parent the selected
                Selection.activeGameObject = stealthScript.pathParent;
            }
        }
예제 #29
0
        private void Receiver(object state)
        {
            var token = (CancellationToken)state;

            while (!token.IsCancellationRequested)
            {
                if (_reader != null && _reader.BaseStream.CanRead && ((NetworkStream)_reader.BaseStream).DataAvailable)
                {
                    while (((NetworkStream)_reader.BaseStream).DataAvailable)
                    {
                        var packetLen = BitConverter.ToUInt32(_reader.ReadBytes(4), 0);

                        var packet = new Packet();
                        packet.Method     = (PacketType)_reader.ReadUInt16();
                        packet.DataLength = _reader.ReadInt16();
                        packet.Data       = _reader.ReadBytes(packet.DataLength);

                        if (Stealth.EnableTracing)
                        {
                            Stealth.AddTraceMessage(string.Format("Read packet. Type: {0}, Param: {1}",
                                                                  packet.Method,
                                                                  string.Join(",", packet.Data.Select(b => b.ToString("X2")))),
                                                    "Stealth.Network");
                        }

                        ProcessPacket(packet);
                    }
                }
                else
                {
                    Thread.Sleep(10);
                }
            }

            token.ThrowIfCancellationRequested();
        }
예제 #30
0
 /// <summary>
 /// Called when an unit goes on stealth.
 /// </summary>
 /// <param name="obj">The Event's arguments</param>
 private static void Stealth_OnStealth(Stealth.OnStealthEventArgs obj)
 {
     if (MenuHelper.isMenuEnabled("dz191.vhr.misc.general.reveal"))
     {
         if (obj.Sender.Distance(ObjectManager.Player) <= 600f && obj.IsStealthed && !obj.Sender.IsMe)
         {
             if (Items.HasItem(2043) && Items.CanUseItem(2043))
             {
                 Items.UseItem(2043, obj.Sender.ServerPosition.Extend(ObjectManager.Player.ServerPosition, 400f));
             }
         }
     }
 }
예제 #31
0
        // PartyMemberAI
        public void UpdateNew()
        {
            if (this.m_mover != null && this.m_mover.AIController == null)
            {
                this.m_mover.AIController = this;
            }
            if (this.m_instructionTimer > 0f)
            {
                PartyMemberAI mInstructionTimer = this;
                mInstructionTimer.m_instructionTimer = mInstructionTimer.m_instructionTimer - Time.deltaTime;
            }
            if (this.m_instructions != null)
            {
                foreach (SpellCastData mInstruction in this.m_instructions)
                {
                    mInstruction.Update();
                }
            }
            if (GameState.s_playerCharacter != null && base.gameObject == GameState.s_playerCharacter.gameObject && PartyMemberAI.DebugParty)
            {
                UIDebug.Instance.SetText("Party Debug", PartyMemberAI.GetPartyDebugOutput(), Color.cyan);
                UIDebug.Instance.SetTextPosition("Party Debug", 0.95f, 0.95f, UIWidget.Pivot.TopRight);
            }
            if (this.m_destinationCircleState != null)
            {
                if (!base.StateManager.IsStateInStack(this.m_destinationCircleState))
                {
                    this.m_destinationCircleState = null;
                    this.HideDestination();
                }
                else
                {
                    this.ShowDestination(this.m_destinationCirclePosition);
                }
            }
            if (!(GameState.s_playerCharacter != null) || !GameState.s_playerCharacter.RotatingFormation || !this.Selected)
            {
                this.HideDestinationTarget();
            }
            else
            {
                this.ShowDestinationTarget(this.m_desiredFormationPosition);
            }
            if (this.m_revealer == null)
            {
                this.CreateFogRevealer();
            }
            else
            {
                this.m_revealer.WorldPos        = base.gameObject.transform.position;
                this.m_revealer.RequiresRefresh = false;
            }
            if (GameState.Paused)
            {
                base.CheckForNullEngagements();
                if (this.m_ai != null)
                {
                    this.m_ai.Update();
                }
                base.DrawDebugText();
                return;
            }
            if (this.m_ai == null)
            {
                return;
            }
            if (GameState.Option.AutoPause.IsEventSet(AutoPauseOptions.PauseEvent.EnemySpotted) || IEModOptions.FastSneak != IEModOptions.FastSneakOptions.Normal)
            {
                this.UpdateEnemySpotted();
            }
            if (this.QueuedAbility != null && this.QueuedAbility.Ready)
            {
                AIState    currentState = this.m_ai.CurrentState;
                Consumable component    = this.QueuedAbility.GetComponent <Consumable>();
                if (!(component != null) || !component.IsIngestibleOrPotion)
                {
                    Attack         attack         = currentState as Attack;
                    TargetedAttack targetedAttack = currentState as TargetedAttack;
                    if (this.QueuedAbility.Passive || attack == null && targetedAttack == null)
                    {
                        this.QueuedAbility.Activate(currentState.Owner);
                    }
                    else if (targetedAttack == null || !this.QueuedAbility.UsePrimaryAttack && !this.QueuedAbility.UseFullAttack)
                    {
                        Ability queuedAbility = AIStateManager.StatePool.Allocate <Ability>();
                        queuedAbility.QueuedAbility = this.QueuedAbility;
                        if (attack == null)
                        {
                            base.StateManager.PushState(queuedAbility);
                        }
                        else if (!attack.CanCancel)
                        {
                            base.StateManager.QueueStateAtTop(queuedAbility);
                        }
                        else
                        {
                            attack.OnCancel();
                            base.StateManager.PopCurrentState();
                            base.StateManager.PushState(queuedAbility);
                        }
                    }
                }
                else
                {
                    ConsumePotion queuedState = this.m_ai.QueuedState as ConsumePotion;
                    if (!(currentState is ConsumePotion) && (queuedState == null || currentState.Priority < 1))
                    {
                        ConsumePotion animationVariation = AIStateManager.StatePool.Allocate <ConsumePotion>();
                        base.StateManager.PushState(animationVariation);
                        animationVariation.Ability          = this.QueuedAbility;
                        animationVariation.ConsumeAnimation = component.AnimationVariation;
                        AttackBase primaryAttack = this.GetPrimaryAttack();
                        if (!(primaryAttack is AttackMelee) || !(primaryAttack as AttackMelee).Unarmed)
                        {
                            animationVariation.HiddenObjects = primaryAttack.GetComponentsInChildren <Renderer>();
                        }
                    }
                }
                this.QueuedAbility = null;
            }
            BaseUpdate();
            if (GameState.IsLoading || GameState.s_playerCharacter == null)
            {
                return;
            }
            if (this.m_alphaControl != null && this.m_alphaControl.Alpha < 1.401298E-45f)
            {
                this.m_alphaControl.Alpha = 1f;
            }
            if (this.m_mover != null && !GameState.InCombat)
            {
                bool fastSneakActive = false;
                if (IEModOptions.FastSneak != IEModOptions.FastSneakOptions.Normal && !(mod_Player.WalkMode))
                {
                    bool canSeeEnemy = false;

                    if (IEModOptions.FastSneak == IEModOptions.FastSneakOptions.FastScoutingSingleLOS)
                    {
                        canSeeEnemy = this.m_enemySpotted;
                    }
                    else if (IEModOptions.FastSneak == IEModOptions.FastSneakOptions.FastScoutingAllLOS)
                    {
                        // if the fastSneak mod is active, then check if any enemies are spotted
                        // if so...we walk
                        for (int i = 0; i < PartyMemberAI.PartyMembers.Length; ++i)
                        {
                            var p = PartyMemberAI.PartyMembers[i];
                            if (p != null && p.m_enemySpotted)
                            {
                                canSeeEnemy = true;
                                break;
                            }
                        }
                    }
                    else
                    {
                        //Should never get here, but make default behavior to not override stealth
                        canSeeEnemy = true;
                    }

                    if (!canSeeEnemy)
                    {
                        fastSneakActive = true;
                    }
                }

                bool         flag                 = ((Stealth.IsInStealthMode(base.gameObject) && !fastSneakActive) || mod_Player.WalkMode);
                float        desiredSpeed         = (!flag ? this.m_mover.GetRunSpeed() : this.m_mover.GetWalkSpeed());
                GameObject[] selectedPartyMembers = PartyMemberAI.SelectedPartyMembers;
                for (int i = 0; i < (int)selectedPartyMembers.Length; i++)
                {
                    GameObject gameObject = selectedPartyMembers[i];
                    if (!(gameObject == null) && !(gameObject == base.gameObject) && flag == Stealth.IsInStealthMode(gameObject))
                    {
                        Mover mover = gameObject.GetComponent <Mover>();
                        if (((!Stealth.IsInStealthMode(gameObject) || fastSneakActive)  ? mover.GetRunSpeed() : mover.GetWalkSpeed()) < desiredSpeed)
                        {
                            desiredSpeed = mover.DesiredSpeed;
                        }
                    }
                }
                if (desiredSpeed < this.m_mover.GetWalkSpeed() * 0.75f)
                {
                    desiredSpeed = this.m_mover.GetWalkSpeed();
                }
                this.m_mover.UseCustomSpeed(desiredSpeed);
            }
        }
예제 #32
0
파일: _2043.cs 프로젝트: riwalry1/AIO
 public _2043()
 {
     Stealth.Init();
 }
예제 #33
0
파일: main.cs 프로젝트: v1ld/IEMod.pw
        // PartyMemberAI
        public void UpdateNew()
        {
            if (this.m_mover != null && this.m_mover.AIController == null)
            {
                this.m_mover.AIController = this;
            }
            if (this.m_instructionTimer > 0f)
            {
                PartyMemberAI mInstructionTimer = this;
                mInstructionTimer.m_instructionTimer = mInstructionTimer.m_instructionTimer - Time.deltaTime;
            }
            if (this.m_instructions != null)
            {
                for (int i = 0; i < this.m_instructions.Count; i++)
                {
                    this.m_instructions[i].Update();
                }
            }
            if (GameState.s_playerCharacter != null && base.gameObject == GameState.s_playerCharacter.gameObject && PartyMemberAI.DebugParty)
            {
                UIDebug.Instance.SetText("Party Debug", PartyMemberAI.GetPartyDebugOutput(), Color.cyan);
                UIDebug.Instance.SetTextPosition("Party Debug", 0.95f, 0.95f, UIWidget.Pivot.TopRight);
            }
            if (this.m_destinationCircleState != null)
            {
                if (!base.StateManager.IsStateInStack(this.m_destinationCircleState))
                {
                    this.m_destinationCircleState = null;
                    this.HideDestination();
                }
                else
                {
                    this.ShowDestination(this.m_destinationCirclePosition);
                }
            }
            if (!(GameState.s_playerCharacter != null) || !GameState.s_playerCharacter.RotatingFormation || !this.Selected)
            {
                this.HideDestinationTarget();
            }
            else
            {
                this.ShowDestinationTarget(this.m_desiredFormationPosition);
            }
            if (this.m_revealer == null)
            {
                this.CreateFogRevealer();
            }
            else
            {
                this.m_revealer.WorldPos        = base.gameObject.transform.position;
                this.m_revealer.RequiresRefresh = false;
            }
            if (GameState.Paused)
            {
                base.CheckForNullEngagements();
                if (this.m_ai != null)
                {
                    this.m_ai.Update();
                }
                return;
            }
            if (this.m_ai == null)
            {
                return;
            }
            if (GameState.Option.AutoPause.IsEventSet(AutoPauseOptions.PauseEvent.EnemySpotted))
            {
                this.UpdateEnemySpotted();
            }
            if (this.QueuedAbility != null && this.QueuedAbility.Ready)
            {
                AIState    currentState = this.m_ai.CurrentState;
                Consumable component    = this.QueuedAbility.GetComponent <Consumable>();
                if (!(component != null) || !component.IsFoodDrugOrPotion)
                {
                    Attack         attack         = currentState as Attack;
                    TargetedAttack targetedAttack = currentState as TargetedAttack;
                    if (this.QueuedAbility.Passive || attack == null && targetedAttack == null)
                    {
                        this.QueuedAbility.Activate(currentState.Owner);
                    }
                    else if (targetedAttack == null || !this.QueuedAbility.UsePrimaryAttack && !this.QueuedAbility.UseFullAttack)
                    {
                        Ability queuedAbility = AIStateManager.StatePool.Allocate <Ability>();
                        queuedAbility.QueuedAbility = this.QueuedAbility;
                        if (attack == null)
                        {
                            base.StateManager.PushState(queuedAbility);
                        }
                        else if (!attack.CanCancel)
                        {
                            base.StateManager.QueueStateAtTop(queuedAbility);
                        }
                        else
                        {
                            attack.OnCancel();
                            base.StateManager.PopCurrentState();
                            base.StateManager.PushState(queuedAbility);
                        }
                    }
                }
                else
                {
                    ConsumePotion queuedState = this.m_ai.QueuedState as ConsumePotion;
                    if (!(currentState is ConsumePotion) && (queuedState == null || currentState.Priority < 1))
                    {
                        ConsumePotion animationVariation = AIStateManager.StatePool.Allocate <ConsumePotion>();
                        base.StateManager.PushState(animationVariation);
                        animationVariation.Ability          = this.QueuedAbility;
                        animationVariation.ConsumeAnimation = component.AnimationVariation;
                        AttackBase primaryAttack = this.GetPrimaryAttack();
                        if (!(primaryAttack is AttackMelee) || !(primaryAttack as AttackMelee).Unarmed)
                        {
                            animationVariation.HiddenObjects = primaryAttack.GetComponentsInChildren <Renderer>();
                        }
                    }
                }
                this.QueuedAbility = null;
            }
            BaseUpdate();
            if (GameState.IsLoading || GameState.s_playerCharacter == null)
            {
                return;
            }
            if (this.m_alphaControl != null && this.m_alphaControl.Alpha < 1.401298E-45f)
            {
                this.m_alphaControl.Alpha = 1f;
            }
            if (this.m_mover != null && !GameState.InCombat)
            {
                bool fastSneakActive = false;
                bool canSeeEnemy     = false;
                bool flag            = true;
                for (int i = 0; i < PartyMemberAI.PartyMembers.Length; ++i)
                {
                    var p = PartyMemberAI.PartyMembers[i];
                    if (p != null && p.m_enemySpotted)
                    {
                        canSeeEnemy = true;
                        break;
                    }
                }

                if (!canSeeEnemy)
                {
                    fastSneakActive = true;
                }

                if (Stealth.IsInStealthMode(base.gameObject) && !fastSneakActive)
                {
                    flag = false;
                }

                this.m_mover.UseCustomSpeed((flag ? 4f : 2f));
            }
        }