Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Attempts to trigger all monsters of the specified type within the specified distance to Sync fire
- void TriggerSync(class<SyncEnabledMonster> targetType, double chance, int maxDist = 2048)
- {
- ThinkerIterator targetFinder = ThinkerIterator.Create(targetType);
- SyncEnabledMonster other;
- while(other = SyncEnabledMonster(targetFinder.Next()))
- {
- if(self == other)
- {
- continue;
- }
- if(!self.CheckSight(other) || !BabelLib.CoarseDistanceCheck(self, other, maxDist))
- {
- continue;
- }
- other.SyncFire(self.target, chance);
- }
- }
- ...
- class SyncEnabledMonster : BabelMonster
- {
- //Triggers the monster's MissileNoSignal state if it isn't afraid or holding its state, and succeeds a roll
- void SyncFire(Actor newTarget, double chance = 0)
- {
- if(health > 0)
- {
- if(!holdingState && !isAfraid)
- {
- if(frandom(0.0, 100.0) <= chance)
- {
- if(newTarget != null && newTarget.GetSpecies() != self.GetSpecies())
- self.target = newTarget;
- else
- return;
- if(checksLOF && (!self.CheckIfTargetInLOS() || !self.CheckLOF()))
- return;
- if(checksLOS && !self.CheckIfTargetInLOS())
- return;
- DisplayComboEffect();
- SetState(ResolveState("MissileNoSignal"));
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement