public IEnumerable <Act.Status> SummonSkeletons() { while (true) { Skeletons.RemoveAll(skeleton => skeleton.IsDead); if (SummonTimer.HasTriggered && Skeletons.Count < MaxSkeletons) { SummonTimer.Reset(SummonTimer.TargetTimeSeconds); for (int i = Skeletons.Count; i < MaxSkeletons; i += 2) { SummonSkeleton(); } yield return(Act.Status.Success); } else if (SummonTimer.HasTriggered) { yield return(Act.Status.Success); } SummonTimer.Update(DwarfTime.LastTime); if (WanderTimer.HasTriggered) { Physics.ApplyForce(MathFunctions.RandVector3Box(-5f, 5f, 0.01f, 0.01f, -5f, 5f), 1f); GatherSkeletons(); } WanderTimer.Update(DwarfTime.LastTime); if (AttackTimer.HasTriggered) { OrderSkeletonsToAttack(); } AttackTimer.Update(DwarfTime.LastTime); yield return(Act.Status.Running); } }
/// <summary> /// Starts the summon. /// </summary> public override void Summon() { lock (m_syncObject) { if (CurrentRegion == null || IsSummoned) return; if (m_timer == null) m_timer = new SummonTimer(this); m_summoned = true; m_timer.Start(1, 100, true, DjinnEvent.Summoning); } }
public IEnumerable <Act.Status> SummonSkeletons() { while (true) { Skeletons.RemoveAll(skeleton => skeleton.IsDead); Creature.CurrentCharacterMode = CharacterMode.Idle; Creature.OverrideCharacterMode = false; SummonTimer.Update(DwarfTime.LastTime); if (SummonTimer.HasTriggered && Skeletons.Count < MaxSkeletons) { Creature.CurrentCharacterMode = Creature.Stats.CurrentClass.AttackMode; Creature.OverrideCharacterMode = true; Creature.Sprite.ReloopAnimations(Creature.Stats.CurrentClass.AttackMode); SoundManager.PlaySound(ContentPaths.Audio.Oscar.sfx_ic_necromancer_summon, Position, true); SummonTimer.Reset(SummonTimer.TargetTimeSeconds); for (int i = Skeletons.Count; i < MaxSkeletons; i += 2) { SummonSkeleton(); } yield return(Act.Status.Success); } else if (SummonTimer.HasTriggered) { yield return(Act.Status.Success); } GatherSkeletonsTimer.Update(DwarfTime.LastTime); if (GatherSkeletonsTimer.HasTriggered) { var wander = new WanderAct(this, GatherSkeletonsTimer.TargetTimeSeconds, 1.0f, 1.0f); foreach (var status in wander.Run()) { GatherSkeletons(); yield return(Act.Status.Running); } } AttackTimer.Update(DwarfTime.LastTime); if (AttackTimer.HasTriggered) { OrderSkeletonsToAttack(); } yield return(Act.Status.Running); } }
/// <summary> /// Starts the summon. /// </summary> public override void Summon() { lock (m_syncObject) { if (CurrentRegion == null || IsSummoned) { return; } if (m_timer == null) { m_timer = new SummonTimer(this); } m_summoned = true; m_timer.Start(1, 100, true, DjinnEvent.Summoning); } }
//Plasma : This code is called from OnSpeech() and is repsonsible for //finding a viable sacirifce and if so to start the summoning protected void SummonStart(ChampLevelData.SpawnTypes ChampType) { //now check the floor for the appropriate sacrifice SummonReq Req = null; ArrayList Reqs = new ArrayList(); //Check through requirements array and add all for this type of spawn for (int i = 0; i < m_SummonReqs.GetLength(0); ++i) { if (m_SummonReqs[i].ChampType == ChampType) { Reqs.Add(m_SummonReqs[i]); } } //Now search the floor for appropriate sacrifice(s) if (Reqs.Count > 0) { //pla: 08/26 changed range to 1 IPooledEnumerable eable = m_Speaker.GetItemsInRange(1); foreach (Item item in eable) { for (int count = 0; count < Reqs.Count; ++count) { Req = ((SummonReq)Reqs[count]); if (item.GetType().IsAssignableFrom(Req.ItemType) && item.Amount >= Req.Amount /* || item.GetType().IsSubclassOf( Req.ItemType ) */) { //Found sacrifice, make it non-movable whilst the summon is in progress item.Movable = false; m_SummonTimer = null; //Start summon timer m_Summoning = true; m_SummonTimer = new SummonTimer(item, Req.ChampType, this, m_bGraphics); eable.Free(); return; } } } eable.Free(); } this.PublicOverheadMessage(0, 0x3B2, false, "The Champion does not see a worthy sacrifice"); }
/// <summary> /// Creates a new SummonedDjinn. /// </summary> /// <param name="djinnStone"></param> public SummonedDjinn(DjinnStone djinnStone) : base(djinnStone) { m_timer = new SummonTimer(this); }
//Plasma : This code is called from OnSpeech() and is repsonsible for //finding a viable sacirifce and if so to start the summoning protected void SummonStart(ChampLevelData.SpawnTypes ChampType) { //now check the floor for the appropriate sacrifice SummonReq Req = null; ArrayList Reqs = new ArrayList(); //Check through requirements array and add all for this type of spawn for( int i = 0; i < m_SummonReqs.GetLength(0); ++i ) if( m_SummonReqs[i].ChampType == ChampType ) Reqs.Add( m_SummonReqs[i] ); //Now search the floor for appropriate sacrifice(s) if( Reqs.Count > 0 ) { //pla: 08/26 changed range to 1 IPooledEnumerable eable = m_Speaker.GetItemsInRange(1); foreach( Item item in eable) { for( int count = 0; count < Reqs.Count; ++count ) { Req = ((SummonReq)Reqs[count]); if( item.GetType().IsAssignableFrom( Req.ItemType ) && item.Amount >= Req.Amount /* || item.GetType().IsSubclassOf( Req.ItemType ) */ ) { //Found sacrifice, make it non-movable whilst the summon is in progress item.Movable=false; m_SummonTimer = null; //Start summon timer m_Summoning = true; m_SummonTimer = new SummonTimer( item, Req.ChampType, this, m_bGraphics ); eable.Free(); return; } } } eable.Free(); } this.PublicOverheadMessage( 0, 0x3B2, false, "The Champion does not see a worthy sacrifice"); }