public SpellExecuting CastMelee(ICaster caster, uint dir, bool lockRealRunes) { var pos = ((Entity)caster).pos; var spEx = new SpellExecuting(caster, this, pos, dir, lockRealRunes); spEx.SpawnAvatar(root, null, pos, dir); //TODO: spawn at spell target? what to do with direction? make random if far? executingSpells.Add(spEx); return(spEx); }
void InterpretFlow() { uint forkCount = 0; Spell.CompiledRune nextRune = null; for (int i = 0; i < 6; i++) { var nrune = rune.neighs[i]; if (nrune == null) { continue; } bool isFlowArrow = IsArrowRune(nrune.type) || nrune.type == RuneType.If; if ((isFlowArrow && !IsArrowFrom(nrune, (uint)i)) || (!isFlowArrow && i != flowDir)) { continue; } if (i == flowDir && !IsFlowCorrect(rune, flowDir)) { continue; } if (forkCount == 0) { nextRune = nrune; } else { if (spell.caster.Mana >= avatarElement.ForkManaCost && avatarElement.CanAvatarFork()) { spell.SpawnAvatar(nrune, this, pos, dir); } else { finishState = FinishedState.CantFork; break; } } ++forkCount; } if (forkCount == 0) { finishState = FinishedState.FlowFinished; } else { rune = nextRune; } }
public SpellExecuting CastRanged(ICaster caster, HexXY target) { var pos = ((Entity)caster).pos; var dist = HexXY.Dist(pos, target); uint dir; if (dist == 0) { dir = ((Entity)caster).dir; } else { dir = HexXY.GetApproximateDir(pos, target); } var spEx = new SpellExecuting(caster, this, target, dir, false); spEx.SpawnAvatar(root, null, target, dir); executingSpells.Add(spEx); return(spEx); }