private bool _spawned; // using my own spawn flag cause Actor.Spawned isn't being used right now public Projectile(PowerContext context, int actorSNO, Vector3D position) : base(context.World, actorSNO) { this.Field2 = 0x8; this.Field7 = 0x00000001; // TODO: test if this is necessary if (this.Scale == 0f) this.Scale = 1.00f; this.Context = context; this.Position = new Vector3D(position); // offset position by mpq collision data this.Position.Z += this.ActorData.Cylinder.Ax1 - this.ActorData.Cylinder.Position.Z; // 2 second default timeout for projectiles this.Timeout = new SecondsTickTimer(context.World.Game, 2f); // copy in important effect params from user this.Attributes[GameAttribute.Rune_A, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_A, context.PowerSNO]; this.Attributes[GameAttribute.Rune_B, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_B, context.PowerSNO]; this.Attributes[GameAttribute.Rune_C, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_C, context.PowerSNO]; this.Attributes[GameAttribute.Rune_D, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_D, context.PowerSNO]; this.Attributes[GameAttribute.Rune_E, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_E, context.PowerSNO]; _prevUpdatePosition = null; _mover = new ActorMover(this); _spawned = false; }
public Projectile(PowerContext context, int actorSNO, Vector3D position) : base(context.World, actorSNO) { this.Field2 = 0x8; this.Scale = 1.35f; // just use default? GBHandle.Projectile is 10, but most projectiles I see use 17 //this.GBHandle.Type = (int)GBHandleType.Projectile; this.GBHandle.GBID = 1; this.Field7 = 0x00000001; // these no longer needed? //this.Field10 = 0x1; //this.Field11 = 0x1; //this.Field12 = 0x1; //this.Field13 = 0x1; //this.CollFlags = 0x4; this.Context = context; this.Position = new Vector3D(position); this.Timeout = new SecondsTickTimer(context.World.Game, 2f); // 2 second default timeout for projectiles // copy in important effect params from user this.Attributes[GameAttribute.Rune_A, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_A, context.PowerSNO]; this.Attributes[GameAttribute.Rune_B, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_B, context.PowerSNO]; this.Attributes[GameAttribute.Rune_C, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_C, context.PowerSNO]; this.Attributes[GameAttribute.Rune_D, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_D, context.PowerSNO]; this.Attributes[GameAttribute.Rune_E, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_E, context.PowerSNO]; _arrivalTime = null; _lastUpdateTick = 0; _prevUpdatePosition = null; _onArrivalCalled = false; // offset position by mpq collision data this.Position.Z += this.ActorData.Cylinder.Ax1 - this.ActorData.Cylinder.Position.Z; }
public override bool Stack(Buff buff) { TimedBuff newbuff = (TimedBuff)buff; // update buff if new timeout is longer than current one, or if new buff has no timeout if (newbuff.Timeout == null || this.Timeout != null && newbuff.Timeout.TimeoutTick > this.Timeout.TimeoutTick) this.Timeout = newbuff.Timeout; return true; }
public sealed override IEnumerable<TickTimer> Run() { if (_runTimeout == null || _runTimeout.TimedOut) { _runTimeout = WaitSeconds(RunDelay); foreach (TickTimer timeout in RunChannel()) yield return timeout; } yield break; }
public override void Think(int tickCounter) { // this needed? /mdz //if (this.Body is NPC) return; // check if in disabled state, if so cancel any action then do nothing if (this.Body.Attributes[GameAttribute.Frozen] || this.Body.Attributes[GameAttribute.Stunned] || this.Body.Attributes[GameAttribute.Blind] || this.Body.World.BuffManager.GetFirstBuff<Powers.Implementations.KnockbackBuff>(this.Body) != null) { if (this.CurrentAction != null) { this.CurrentAction.Cancel(tickCounter); this.CurrentAction = null; } _powerDelay = null; return; } // select and start executing a power if no active action if (this.CurrentAction == null) { // do a little delay so groups of monsters don't all execute at once if (_powerDelay == null) _powerDelay = new SecondsTickTimer(this.Body.World.Game, (float)RandomHelper.NextDouble()); if (_powerDelay.TimedOut) { if (this.Body.GetObjectsInRange<Monster>(40f).Count != 0) { _target = this.Body.GetObjectsInRange<Monster>(40f)[0]; //System.Console.Out.WriteLine("Enemy in range, use powers"); //This will only attack when you and your minions are not moving..TODO: FIX. int powerToUse = PickPowerToUse(); if (powerToUse > 0) this.CurrentAction = new PowerAction(this.Body, powerToUse,_target); } else { //System.Console.Out.WriteLine("No enemies in range, return to master"); this.CurrentAction = new MoveToPointAction(this.Body, this.Body.CheckPointPosition); } } } }
public EffectActor(PowerContext context, int actorSNO, Vector3D position) : base(context.World, actorSNO) { this.Field2 = 0x8; if (this.Scale == 0f) this.Scale = 1f; this.Position = position; this.Timeout = null; // copy in important effect params from user this.Attributes[GameAttribute.Rune_A, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_A, context.PowerSNO]; this.Attributes[GameAttribute.Rune_B, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_B, context.PowerSNO]; this.Attributes[GameAttribute.Rune_C, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_C, context.PowerSNO]; this.Attributes[GameAttribute.Rune_D, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_D, context.PowerSNO]; this.Attributes[GameAttribute.Rune_E, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_E, context.PowerSNO]; }
public override void Think(int tickCounter) { // this needed? /mdz if (this.Body is NPC) return; // check if in disabled state, if so cancel any action then do nothing if (this.Body.Attributes[GameAttribute.Frozen] || this.Body.Attributes[GameAttribute.Stunned] || this.Body.Attributes[GameAttribute.Blind] || this.Body.World.BuffManager.GetFirstBuff<Powers.Implementations.KnockbackBuff>(this.Body) != null || this.Body.World.BuffManager.GetFirstBuff<Powers.Implementations.SummonedBuff>(this.Body) != null) { if (this.CurrentAction != null) { this.CurrentAction.Cancel(tickCounter); this.CurrentAction = null; } _powerDelay = null; return; } // select and start executing a power if no active action if (this.CurrentAction == null) { // do a little delay so groups of monsters don't all execute at once if (_powerDelay == null) _powerDelay = new SecondsTickTimer(this.Body.World.Game, (float)RandomHelper.NextDouble()); if (_powerDelay.TimedOut) { int powerToUse = PickPowerToUse(); if (powerToUse > 0) { this.CurrentAction = new PowerAction(this.Body, powerToUse); } } } }
public virtual void Update(int tickCounter) { if (Timeout != null && Timeout.TimedOut) { if (OnTimeout != null) OnTimeout(); this.Destroy(); } else if (OnUpdate != null) { if (_updateTimer == null || _updateTimer.TimedOut) { OnUpdate(); if (this.UpdateDelay > 0f) _updateTimer = new SecondsTickTimer(this.Context.World.Game, this.UpdateDelay); else _updateTimer = null; } } }
public sealed override IEnumerable<TickTimer> Run() { // process channeled skill events if (IsChannelOpen) { OnChannelUpdated(); } else // first call to this skill's Run(), set channel as open { OnChannelOpen(); IsChannelOpen = true; } // run main script if ready if (_effectTimeout == null || _effectTimeout.TimedOut) { _effectTimeout = WaitSeconds(EffectsPerSecond); foreach (TickTimer timeout in Main()) yield return timeout; } }
public override bool Update() { _mover.Update(); if (base.Update()) return true; if (_damageTimer == null || _damageTimer.TimedOut) { _damageTimer = WaitSeconds(_damageRate); AttackPayload attack = new AttackPayload(this); attack.AddWeaponDamage(ScriptFormula(16), DamageType.Physical); attack.Targets = GetEnemiesInRadius(User.Position, ScriptFormula(6)); attack.OnHit = hit => { hitAnything = true; Knockback(hit.Target, ScriptFormula(2)); if (Rune_B > 0) { User.Attributes[GameAttribute.Hitpoints_Granted] += ScriptFormula(21); User.Attributes.BroadcastChangedIfRevealed(); } if (Rune_D > 0) { GeneratePrimaryResource(ScriptFormula(11)); } if (Rune_C > 0) { if (hit.IsCriticalHit) { AddBuff(hit.Target, new DebuffStunned(WaitSeconds(ScriptFormula(8)))); } } if (Rune_E > 0) { int resourceHit = 0; while (resourceHit < ScriptFormula(10)) { //maybe this cannot go here? } } }; attack.Apply(); } return false; }
public override bool Update() { if (base.Update()) return true; if (_damageTimer == null || _damageTimer.TimedOut) { _damageTimer = WaitSeconds(_damageRate); WeaponDamage(Target, ScriptFormula(16), DamageType.Holy); } return false; }
public override bool Update() { if (base.Update()) return true; if (_damageTimer == null || _damageTimer.TimedOut) { _damageTimer = WaitSeconds(_damageRate); AttackPayload attack = new AttackPayload(this); attack.SetSingleTarget(Target); attack.AddWeaponDamage(ScriptFormula(6) * _damageRate, DamageType.Physical); attack.AutomaticHitEffects = false; attack.Apply(); } return false; }
public SerenityAlliesBuff(TickTimer timeout) { Timeout = timeout; }
//AuraBuff public ReclamationAura(TickTimer timeout) { Timeout = timeout; }
public ConvictionAura(TickTimer timeout) { Timeout = timeout; }
//grantee public CastGroupBuff(TickTimer timeout) { Timeout = timeout; }
//holyAuraRune_shield.efg public HealingShield(TickTimer timeout) { Timeout = timeout; }
public IndigoDebuff(TickTimer timeout) { Timeout = timeout; }
public override bool Update() { if (base.Update()) return true; if (_damageTimer == null || _damageTimer.TimedOut) { _damageTimer = WaitSeconds(_damageRate); foreach (Actor Enemy in GetEnemiesInRadius(User.Position, ScriptFormula(5)).Actors) { AddBuff(Enemy, new DeBuff()); if (Rune_C > 0) { AddBuff(Enemy, new DebuffSlowed(ScriptFormula(7), WaitSeconds(0.5f))); } } } return false; }
public DOTbuff(TickTimer timeout) { Timeout = timeout; }
public SerenityBuff(TickTimer timeout) { Timeout = timeout; }
public override bool Update() { if (base.Update()) return true; if (_damageTimer == null || _damageTimer.TimedOut) { _damageTimer = WaitSeconds(_damageRate); WeaponDamage(GetEnemiesInRadius(Target.Position, 15f), ScriptFormula(31), DamageType.Holy); } return false; }
public CycloneDodgeBuff(TickTimer timeout) { Timeout = timeout; }
//firedamage public FireDamageBuff(TickTimer timeout) { Timeout = timeout; }
public override bool Update() { if (base.Update()) return true; if (_damageTimer == null || _damageTimer.TimedOut) { _damageTimer = WaitSeconds(_damageRate); AttackPayload attack = new AttackPayload(this); attack.Targets = GetEnemiesInRadius(User.Position, ScriptFormula(13)); attack.AddWeaponDamage(_damagetotal, DamageType.Physical); //we divide by four because this is by second, and tick-intervals = 0.25 attack.AutomaticHitEffects = false; attack.Apply(); } return false; }
//spirit public SpiritBuff(TickTimer timeout) { Timeout = timeout; }
public override bool Update() { if (base.Update()) return true; if (_damageTimer == null || _damageTimer.TimedOut) { _damageTimer = WaitSeconds(_damageRate); if (Rune_E > 0) { WeaponDamage(Target, ScriptFormula(7), DamageType.Physical); } else WeaponDamage(Target, ScriptFormula(20), DamageType.Physical); } return false; }
public override bool Update() { if (base.Update()) return true; if (_damageTimer == null || _damageTimer.TimedOut) { _damageTimer = WaitSeconds(_damageRate); AttackPayload attack = new AttackPayload(this); attack.Targets = GetEnemiesInRadius(User.Position, ScriptFormula(4)); attack.AddWeaponDamage(ScriptFormula(14), DamageType.Physical); attack.Apply(); } return false; }
public override bool Update() { if (base.Update()) return true; if (_damageTimer == null || _damageTimer.TimedOut) { _damageTimer = WaitSeconds(ScriptFormula(0)); UsePrimaryResource(EvalTag(PowerKeys.ResourceCost)); //TODO: THIS is where Rune_E goes. On Crit Hits, restores some HP. WeaponDamage(GetEnemiesInRadius(User.Position, ScriptFormula(2)), ScriptFormula(1), Rune_A > 0 ? DamageType.Fire : DamageType.Physical); } if (Rune_B > 0) { // spawn tornado projectiles in random directions every timed period if (_tornadoSpawnTimer == null) _tornadoSpawnTimer = WaitSeconds(ScriptFormula(5)); if (_tornadoSpawnTimer.TimedOut) { _tornadoSpawnTimer = WaitSeconds(ScriptFormula(5)); var tornado = new Projectile(this, 162386, User.Position); tornado.Timeout = WaitSeconds(3f); tornado.OnCollision = (hit) => { WeaponDamage(hit, ScriptFormula(6), DamageType.Physical); }; tornado.Launch(new Vector3D(User.Position.X + (float)Rand.NextDouble() - 0.5f, User.Position.Y + (float)Rand.NextDouble() - 0.5f, User.Position.Z), 0.25f); } } return false; }
//grantor public CastEffect(TickTimer timeout) { Timeout = timeout; }