public override object Update(SpellDef input, SpellDef spell, CharacterEntity ent, object state) { var selfState = (TargetPointCastState)state; if (selfState == null) { selfState = new TargetPointCastState(); } var targetWorldPos = EnvironmentAPI.Input.GlobalMousePos; selfState.T = new HierarchyTransform(targetWorldPos, 0, null); if (Input.Def.IsActive(selfState.TriggerWasActive)) { //Logger.LogError($"{input.____GetDebugShortName()} {spell.____GetDebugShortName()}"); ent.ActionEngine.DoInput(input, new SpellCast() { Def = spell, TargetPoint = targetWorldPos, OwnerObject = ent.Id }); selfState.TriggerWasActive = true; } if (!Input.Def.IsActive(selfState.TriggerWasActive)) { selfState.TriggerWasActive = false; } return(selfState); }
public Meteor(SpellDef def, DungeonObject owner, Vector2 position) : base(def, owner, owner.Position) { Position = new Vector2((int)position.X / 16 * 16, (int)position.Y / 16 * 16); State = Active; StateCompleteAction = () => State = Hit; }
public Spell(SpellDef def, DungeonObject owner, Vector2 position) : base(def, position, "spells", state: Cast) { SpellDef = def; Position = new((int)Position.X / 16 * 16, (int)Position.Y / 16 * 16); game = DungeonGame.Instance; player = DungeonPlayer.Instance; Owner = owner; }
public Lightning(SpellDef def, DungeonObject owner, Vector2 position) : base(def, owner, position) { Position = new Vector2((int)position.X / 16 * 16, (int)position.Y / 16 * 16); State = Active; StateCompleteAction = () => { State = Hit; StateCompleteAction = () => State = Dead; }; }
public Flame(SpellDef def, DungeonObject owner, Vector2 position) : base(def, owner, position) { Position = new Vector2((int)position.X / 16 * 16, (int)position.Y / 16 * 16); State = Cast; StateCompleteAction = () => { State = Active; StateCompleteAction = null; CurrentlyBlockingInput = false; }; }
public SpellDef GetSpell(SpellDef baseSpell) { int maxValue = -1; SpellDef maxOverride = null; foreach (var overrideLayer in _overrides) { if (overrideLayer.Value.Index > maxValue && overrideLayer.Value.Overrides.TryGetValue(baseSpell, out var overrideSpell)) { maxValue = overrideLayer.Value.Index; maxOverride = overrideSpell; } } return(maxOverride); }
public Fireball(SpellDef def, Vector2 start, Vector2 end) : base(def, start) { var(x1, y1) = Position; var(x2, y2) = end; var xDiff = x2 - x1; var yDiff = y2 - y1; Rotation = MathF.Atan2(yDiff, xDiff); StateCompleteAction = () => State = Active; FlightPath = Position.CastRay(end, true, true, true, true).GetEnumerator(); }
public Fireball(SpellDef def, DungeonObject owner, Vector2 end) : base(def, owner, owner.Position) { Position = new Vector2((int)owner.Position.X / 16 * 16, (int)owner.Position.Y / 16 * 16); end = new((int)end.X / 16 * 16, (int)end.Y / 16 * 16); var(x1, y1) = Position; var(x2, y2) = end; float xDiff = x2 - x1; float yDiff = y2 - y1; Rotation = MathF.Atan2(yDiff, xDiff); StateCompleteAction = () => State = Active; FlightPath = Position.CastRay(end, true, true, true, true).GetEnumerator(); }
public abstract object Update(SpellDef input, SpellDef spell, CharacterEntity ent, object state);
public Spell(SpellDef def, Vector2 position) : base(def, position, "spells", state: Cast) { SpellDef = def; }