public IASpell(int spellId, int relaunchs, SpellTarget target = SpellTarget.Enemy, bool condition = true) { SpellId = spellId; Relaunchs = relaunchs; Target = target; Condition = condition; }
public SavedFlowerState(SpellTarget target, TimeSpan?interval, int?manaThreshold = null) { if (target == null) { throw new ArgumentNullException("target"); } TargetMode = target.Units; CharacterName = target.CharacterName; LocationX = target.Location.X; LocationY = target.Location.Y; OffsetX = target.Offset.X; OffsetY = target.Offset.Y; InnerRadius = target.InnerRadius; OuterRadius = target.OuterRadius; if (interval.HasValue) { Interval = interval.Value; } if (manaThreshold.HasValue) { ManaThreshold = manaThreshold.Value; } }
public CardInfo() { //Valores base Attack = Health = 0; Taunt = Charge = Stealth = Windfury = false; SpellTarget = SpellTarget.NOTARGET; Effect = new Effect(); }
public IASpell(int spellId, int relaunchs, SpellTarget target, bool handToHand, bool moveFirst, SpellLevel spellLevel) { SpellId = spellId; Relaunchs = relaunchs; Target = target; HandToHand = handToHand; MoveFirst = moveFirst; Name = D2OParsing.GetSpellName(SpellId); Spell = spellLevel; }
public DB_SpellEffect(byte type, byte target, float data01, float data02, float data03, float bConst, float mLevel, float mAttack) { Type = (SpellEffectType)type; Target = (SpellTarget)target; Data01 = data01; Data02 = data02; Data03 = data03; BaseConst = bConst; LevelModifer = mLevel; AttackModifer = mAttack; }
SpellQueueItem GetLyliacPlant(SpellTarget target) { if (lyliacPlantQueueItem == null) { lyliacPlantQueueItem = new SpellQueueItem(); lyliacPlantQueueItem.Name = Spell.LyliacPlantKey; } lyliacPlantQueueItem.Target = target; return(lyliacPlantQueueItem); }
public WaitForSpells(int players) { SpellTarget empty = new SpellTarget { spell = -1, target = -1 }; SpellTargets = new SpellTarget[players]; for (int i = 0; i < players; ++i) { SpellTargets[i] = empty; } currentTime = 0; }
public BasicAttack(string _SpellID, string _SpellName, string _SpellIMG, float _SpellRecastTime, float _SpellAmount, float _SpellEffectLast, SpellType _spellType, SpellTarget _spellTarget, SpellTargetZone _spellTargetZone, SpellTargetProperty _spellTargetProperty) { SpellID = _SpellID; SpellName = _SpellName; SpellIMG = _SpellIMG; SpellRecastTime = _SpellRecastTime; SpellAmount = _SpellAmount; SpellEffectLast = _SpellEffectLast; spellType = _spellType; spellTarget = _spellTarget; spellTargetZone = _spellTargetZone; spellTargetProperty = _spellTargetProperty; }
public Spell(Spells type, Creature agent, DrawerBattle drawer, InterfaceBattle myInterface, SpellTarget targetType, UInt16 range, UInt16 magnitude, UInt16 executionTime) { _type = type; _agent = agent; _map = _agent.MapBattlemap; _drawer = drawer; _interface = myInterface; _targetType = targetType; //_spellEffects = spellEffects; _range = range; _magnitude = magnitude; _executionTime = executionTime; }
void SetTargetForMode(SpellTarget target) { if (target == null) { return; } targetModeComboBox.SelectedValue = target.Units.ToString(); switch (target.Units) { case TargetCoordinateUnits.Character: characterComboBox.SelectedValue = target.CharacterName; break; case TargetCoordinateUnits.AbsoluteTile: absoluteTileXUpDown.Value = target.Location.X; absoluteTileYUpDown.Value = target.Location.Y; break; case TargetCoordinateUnits.AbsoluteXY: absoluteXUpDown.Value = target.Location.X; absoluteYUpDown.Value = target.Location.Y; break; case TargetCoordinateUnits.RelativeTile: relativeTileXComboBox.SelectedItem = (int)target.Location.X; relativeTileYComboBox.SelectedItem = (int)target.Location.Y; break; case TargetCoordinateUnits.RelativeXY: relativeXUpDown.Value = target.Location.X; relativeYUpDown.Value = target.Location.Y; break; case TargetCoordinateUnits.RelativeRadius: innerRadiusUpDown.Value = target.InnerRadius; outerRadiusUpDown.Value = target.OuterRadius; goto case TargetCoordinateUnits.RelativeTile; case TargetCoordinateUnits.AbsoluteRadius: innerRadiusUpDown.Value = target.InnerRadius; outerRadiusUpDown.Value = target.OuterRadius; goto case TargetCoordinateUnits.AbsoluteTile; } offsetXUpDown.Value = target.Offset.X; offsetYUpDown.Value = target.Offset.Y; }
public static void do_particles(SpellTarget target) { var part_str = "sp-Death Ward"; if (GameSystems.Stat.DispatchGetSizeCategory(target.Object) <= SizeCategory.Medium) { part_str = "sp-Death Ward-MED"; } else if (GameSystems.Stat.DispatchGetSizeCategory(target.Object) == SizeCategory.Large) { part_str = "sp-Death Ward-LARGE"; } else { part_str = "sp-Death Ward-HUGE"; } target.ParticleSystem = AttachParticles(part_str, target.Object); }
public static void do_particles(SpellTarget target) { var part_str = "sp-Otilukes Resilient Sphere"; if (GameSystems.Stat.DispatchGetSizeCategory(target.Object) <= SizeCategory.Medium) { part_str = "sp-Otilukes Resilient Sphere-MED"; } else if (GameSystems.Stat.DispatchGetSizeCategory(target.Object) == SizeCategory.Large) { part_str = "sp-Otilukes Resilient Sphere-LARGE"; } else { part_str = "sp-Otilukes Resilient Sphere-HUGE"; } target.ParticleSystem = AttachParticles(part_str, target.Object); }
public void IAUnitAttack(int IAAttackingUnit, int _TargetAttackedUnit, SpellTarget TargetPlayerOrIA, string SpellID) { Unit _IAUnitGameObject; switch (TargetPlayerOrIA) { case SpellTarget.IAUNIT: IAUnitCrew.TryGetValue(IAAttackingUnit, out _IAUnitGameObject); UnitBattle _IAUnitBattle = _IAUnitGameObject.InstantiatedUnit.GetComponent <UnitBattle>(); _IAUnitBattle.IASpellAttack(SpellID, _TargetAttackedUnit, IAAttackingUnit); break; case SpellTarget.ALLY: case SpellTarget.SELF: default: /*EnemyUnitCrew.TryGetValue(IAAttackingUnit, out _UnitGameObject); * UnitBattle _IAUnitBattle = _UnitGameObject.InstantiatedUnit.GetComponent<UnitBattle>(); * _IAUnitBattle.IAAttack(_TargetAttackedUnit);*/ break; } }
public SavedSpellState(string spellName, SpellTarget target, int?targetLevel = null) { if (target == null) { throw new ArgumentNullException("target"); } SpellName = spellName; TargetMode = target.Units; CharacterName = target.CharacterName; LocationX = target.Location.X; LocationY = target.Location.Y; OffsetX = target.Offset.X; OffsetY = target.Offset.Y; InnerRadius = target.InnerRadius; OuterRadius = target.OuterRadius; if (targetLevel.HasValue) { TargetLevel = targetLevel.Value; } }
protected override void HandleMonsters(Character p_attacker, SpellEventArgs p_result, List <Object> p_targets, Single p_magicFactor) { base.HandleMonsters(p_attacker, p_result, p_targets, p_magicFactor); m_CachePushed.Clear(); for (Int32 i = p_result.SpellTargets.Count - 1; i >= 0; i--) { SpellTarget spellTarget = p_result.SpellTargets[i]; Monster monster = spellTarget.Target as Monster; if (monster != null && m_CachePushed.Add(monster)) { AttackedTarget attackedTarget = spellTarget as AttackedTarget; if (attackedTarget != null && attackedTarget.Result.Result != EResultType.EVADE) { PushBack(monster, p_result); } MonsterBuffTarget monsterBuffTarget = spellTarget as MonsterBuffTarget; if (monsterBuffTarget != null) { PushBack(monster, p_result); } } } }
public static bool TargetsEnemy(this SpellTarget spellTarget) => spellTarget switch {
private void ParseTrajet(string path) { if (string.IsNullOrEmpty(path) || !File.Exists(path)) { return; } RessourcesToGather.Clear(); try { script = new Script(); script.Globals["log"] = (Action <string>)LogMethod; script.Globals["Breed"] = (Func <int>)CharacterBreed; script.Globals["inv"] = new Inventory(Account, false); script.DoFile(path); }catch (ScriptRuntimeException e) { Logger.Default.Log($"ScriptRuntimeException was thrown at [{path}] => \n {e.Message}"); } catch (SyntaxErrorException e) { Logger.Default.Log($"SyntaxErrorException was thrown at [{path}] => \n {e.Message}"); } #region WhatToGather /* What To Gather */ DynValue Gather = script.Globals.Get("GATHER"); if (Gather.IsNotNil()) { foreach (var elem in Gather.Table.Values) { RessourcesToGather.Add(elem.ToObject <int>()); } } #endregion #region AI /* AI */ DynValue playPassive = script.Globals.Get("PLAY_PASSIVE"); ((Character)Account.Character).Ia = new ArtificialIntelligence(); DynValue Spells = script.Call(script.Globals.Get("spells")); if (Spells.IsNil()) { throw new Exception("spells cannot be null"); } var spells = new List <IASpell>(); foreach (var elem in Spells.Table.Values) { int SpellId = -1; int Relaunchs = -1; SpellTarget Target = SpellTarget.Enemy; bool HandToHand = false; bool MoveFirst = false; foreach (var pair in elem.Table.Pairs) { switch (pair.Key.ToString().ToLower()) { case "\"spell\"": SpellId = int.Parse(pair.Value.ToString()); break; case "\"target\"": var targettmp = pair.Value.ToString(); switch (targettmp.ToLower()) { case "\"self\"": Target = SpellTarget.Self; break; case "\"enemy\"": Target = SpellTarget.Enemy; break; case "\"ally\"": Target = SpellTarget.Ally; break; } break; case "\"relaunchs\"": case "\"relaunch\"": Relaunchs = int.Parse(pair.Value.ToString()); break; case "\"handtohand\"": HandToHand = pair.Value.CastToBool(); break; case "\"movefirst\"": MoveFirst = pair.Value.CastToBool(); break; default: //Console.WriteLine(@"Erreur: " + key); break; } } Console.WriteLine($@"Spell ({SpellId}), Target: {Target}, Relaunchs: {Relaunchs}, HandToHand: {HandToHand}, MoveFirst: {MoveFirst}"); //{/*script.Call(Condition,110) */} if (spells.Exists(x => x.SpellId == SpellId)) { throw new Exception($"Spell[{SpellId}] has already been added."); } var spellLevel = -1; var spell = Account.Character.Spells.FirstOrDefault(s => s.SpellId == SpellId); if (spell != null) { spellLevel = spell.SpellLevel; } if (spellLevel == -1) { return; } var spellData = ObjectDataManager.Instance.Get <API.Datacenter.Spell>(SpellId); if (spellData == null) { return; } var spellLevelId = spellData.SpellLevels[spellLevel - 1]; var spellLevelData = ObjectDataManager.Instance.Get <SpellLevel>(spellLevelId); if (spellLevelData == null) { return; } spells.Add(new IASpell(SpellId, Relaunchs, Target, HandToHand, MoveFirst, spellLevelData)); } ((Character)Account.Character).Ia.Load(Account, spells); #endregion }
public void SetTargetSpell(int player, SpellTarget spellTarget) { waitForSpells.SetSpellTarget(player, spellTarget); }
public void SetSpellTarget(int player, SpellTarget spellTarget) { RockPaperSpell.Controller.SetTargetSpell(player, spellTarget); }
private bool TryToCastSpell(SpellTarget target, SpellCategory category, bool checkCastState) { try { //if (checkCastState && _localPlayerCharacterView.IsCasting()) // return true; if (checkCastState && _localPlayerCharacterView.IsCasting()) { return(false); } var spells = _combatSpells.Target(target).Category(category); // Core.Log($"{_localPlayerCharacterView.IsCasting()}"); SpellSlot spellToCast; if (spells.Count() > 1) { Random random = new Random(DateTime.Now.Millisecond); spellToCast = spells.ElementAt(random.Next(0, spells.Count())); } else { //var spellToCast = spells.Any() ? spells.First() : null; spellToCast = spells.Any() ? spells.First() : null; } if (spellToCast == null) { return(false); } var spellName = "Unknown"; try { spellName = spellToCast.GetSpellDescriptor().TryGetName(); Core.Log($"[Casting {spellName}]"); var spellSlot = spellToCast.Slot; castStart1 = _localPlayerCharacterView.GetCastStartTime(); castStart2 = _localPlayerCharacterView.GetChannelingStartTimeStamp(); castEnd = _localPlayerCharacterView.GetCastEndTime(); castEnd2 = _localPlayerCharacterView.GetCastFinishedEndTimeStamp(); switch (target) { case (SpellTarget.Self): _localPlayerCharacterView.CastOnSelf(spellSlot); break; case (SpellTarget.Enemy): _localPlayerCharacterView.CastOn(spellSlot, _combatTarget); break; case (SpellTarget.Ground): _localPlayerCharacterView.CastAt(spellSlot, _combatTarget.GetPosition()); break; default: Core.Log($"[SpellTarget {target} is not supported. Spell skipped]"); return(false); } _combatCooldown = 0.1f; return(true); } catch (Exception e) { Core.Log($"[Error while casting {spellName} ({target}/{category}/{checkCastState})]"); Core.Log(e); return(false); } } catch (Exception e) { Core.Log($"[Generic casting error ({target}/{category}/{checkCastState})]"); Core.Log(e); return(false); } }
private bool TryToCastSpell(SpellTarget target, SpellCategory category, bool checkCastState) { try { if (checkCastState && _localPlayerCharacterView.IsCasting()) { Core.Log("You are casting. Wait for casting to finish"); return(false); } var spells = _combatSpells.Target(target).Category(category); var spellToCast = spells.Any() ? spells.First() : null; if (spellToCast == null) { Core.LogOnce("Spell to Cast == Null. Exit spell cast"); return(false); } var spellName = "Unknown"; try { spellName = spellToCast.GetSpellDescriptor().TryGetName(); var spellSlot = spellToCast.Slot; switch (target) { case (SpellTarget.Self): Core.Log("Casting " + spellName + " on self."); _localPlayerCharacterView.CastOnSelf(spellSlot); break; case (SpellTarget.Enemy): Core.Log("Casting " + spellName + " on enemy."); _localPlayerCharacterView.CastOn(spellSlot, _combatTarget); break; case (SpellTarget.Ground): Core.Log("Casting " + spellName + " on ground."); _localPlayerCharacterView.CastAt(spellSlot, _combatTarget.GetPosition()); break; default: Core.Log($"[SpellTarget {target} is not supported. Spell skipped]"); return(false); } _combatCooldown = 0.1f; return(true); } catch (Exception e) { Core.Log($"[Error while casting {spellName} ({target}/{category}/{checkCastState})]"); Core.Log(e); return(false); } } catch (Exception e) { Core.Log($"[Generic casting error ({target}/{category}/{checkCastState})]"); Core.Log(e); return(false); } }
public static g7.SpellTarget ToInternal(this SpellTarget instance) { return((g7.SpellTarget)instance); }
public SkillBasicAttackMelee(Creature agent, DrawerBattle drawer, InterfaceBattle myInterface, SpellTarget targetType, UInt16 magnitude, UInt16 executionTime) : base(Spells.SkillMelee, agent, drawer, myInterface, targetType, 1, magnitude, executionTime) { }
public SpellFilterChain FilterByTarget(SpellTarget target) { return(Filter(new TargetFilter(target))); }
public void PlayerUnitAttack(int PlayerAttackingUnit, int _TargetAttackedUnit, SpellTarget TargetPlayerOrIA, string SpellID) { Unit _PlayerUnitGameObject; switch (TargetPlayerOrIA) { case SpellTarget.IAUNIT: PlayerUnitCrew.TryGetValue(PlayerAttackingUnit, out _PlayerUnitGameObject); UnitBattle _PlayerUnitBattle = _PlayerUnitGameObject.InstantiatedUnit.GetComponent <UnitBattle>(); _PlayerUnitBattle.PlayerSpellAttack(SpellID, _TargetAttackedUnit, PlayerAttackingUnit); break; case SpellTarget.ALLY: case SpellTarget.SELF: default: PlayerUnitCrew.TryGetValue(PlayerAttackingUnit, out _PlayerUnitGameObject); UnitBattle _PlayerUnitBattleBuff = _PlayerUnitGameObject.InstantiatedUnit.GetComponent <UnitBattle>(); _PlayerUnitBattleBuff.PlayerSpellBuff(SpellID, _TargetAttackedUnit, PlayerAttackingUnit); break; } }
private bool CastSpellPart(int currentPart, int spellX, int spellZ, int strength) { bool partFound = false; int patternWidth = mPattern.GetLength(0); int patternHeight = mPattern.GetLength(1); GameObject spellContainer = new GameObject(); spellContainer.transform.position = transform.position; for (int x = 0; x < patternWidth; ++x) { for (int z = 0; z < patternHeight; ++z) { int offsetX = -patternWidth / 2 + x; int offsetZ = -patternHeight / 2 + z; int targetX = spellX + offsetX; int targetZ = spellZ + offsetZ; if (mPattern[x, z] == currentPart) { GameObject targetObj = GameObject.Instantiate(PrefabManager.instance.PrefabByName("SpellTarget"), spellContainer.transform); SpellTarget target = targetObj.GetComponent <SpellTarget>(); targetObj.transform.position = new Vector3(targetX, 1f, -targetZ); target.castTime = 1f * (1f / castSpeed); target.strength = strength; targetObj.SetLayerRecursive(gameObject.layer); targetObj.GetComponentInChildren <Renderer>().enabled = showTargetArea; target.effect = effectName; target.hideEffectIfNoHit = hideEffectIfNoHit; target.effectOffset = effectOffset; target.triggerSFX = triggerSFX; partFound = true; } } } if (orientToDirection) { Quaternion rotation; if (commonComponents != null && commonComponents.animator != null) { rotation = commonComponents.animator.transform.localRotation; } else { rotation = transform.localRotation; } spellContainer.transform.localRotation = rotation; // Round the Y rotation to the nearest 90 degree interval; root motion makes the rotation a little imprecise. float y = spellContainer.transform.localRotation.eulerAngles.y; y = Mathf.Round(y / 90) * 90.0f; spellContainer.transform.localRotation = Quaternion.Euler(spellContainer.transform.localRotation.eulerAngles.x, y, spellContainer.transform.localRotation.eulerAngles.z); } if (randomOrientation) { spellContainer.transform.localRotation = commonComponents.animator.transform.localRotation; // Round the Y rotation to the nearest 90 degree interval; root motion makes the rotation a little imprecise. float y = Random.Range(0, 4) * 90; spellContainer.transform.localRotation = Quaternion.Euler(spellContainer.transform.localRotation.eulerAngles.x, y, spellContainer.transform.localRotation.eulerAngles.z); } for (int i = 0; i < spellContainer.transform.childCount; ++i) { Transform target = spellContainer.transform.GetChild(i); // convert the target position to map coordinates Vector2Int mapCoords = MapCoordinateHelper.WorldToMapCoords(target.position); if (!Game.instance.levelGenerator.dungeon.IsPositionInBounds(mapCoords) || Game.instance.levelGenerator.dungeon.TileType(mapCoords) == OMM.RDG.RandomDungeonTileData.EMPTY_TILE || (dontCastOnWalls && Game.instance.levelGenerator.dungeon.TileType(mapCoords) == OMM.RDG.RandomDungeonTileData.WALL_TILE)) { Destroy(target.gameObject); } } return(partFound); }
void ClickTarget(SpellTarget target) { if (target == null) { throw new ArgumentNullException("target"); } if (target.Units == TargetCoordinateUnits.None) { return; } var pt = new Point(); var radiusPoint = new Point(); switch (target.Units) { case TargetCoordinateUnits.AbsoluteXY: pt = target.Location; break; case TargetCoordinateUnits.AbsoluteTile: pt = GetAbsoluteTilePoint((int)target.Location.X, (int)target.Location.Y); break; case TargetCoordinateUnits.Character: pt = GetCharacterPoint(target.CharacterName); break; case TargetCoordinateUnits.RelativeTile: pt = GetRelativeTilePoint((int)target.Location.X, (int)target.Location.Y); break; case TargetCoordinateUnits.RelativeXY: pt = new Point(315 + target.Location.X, 160 + target.Location.Y); break; case TargetCoordinateUnits.Self: pt = new Point(315, 160); break; case TargetCoordinateUnits.AbsoluteRadius: radiusPoint = target.GetNextRadiusPoint(); pt = GetAbsoluteTilePoint((int)radiusPoint.X, (int)radiusPoint.Y); break; case TargetCoordinateUnits.RelativeRadius: radiusPoint = target.GetNextRadiusPoint(); pt = GetRelativeTilePoint((int)radiusPoint.X, (int)radiusPoint.Y); break; } // scale for window if (client.Process.WindowScaleX > 0 && client.Process.WindowScaleX != 1) { pt.X *= client.Process.WindowScaleX; } if (client.Process.WindowScaleY > 0 && client.Process.WindowScaleY != 1) { pt.Y *= client.Process.WindowScaleY; } // apply final offset pt.Offset(target.Offset.X, target.Offset.Y); client.ClickAt(pt.X, pt.Y); }
public SKillBasicAttackRanged(Creature agent, DrawerBattle drawer, InterfaceBattle myInterface, SpellTarget targetType, UInt16 magnitude, UInt16 executionTime) : base(Spells.SkillRanged, agent, drawer, myInterface, targetType, agent.GetAttackRange(), magnitude, executionTime) { }
public TargetFilter(SpellTarget target) { this.target = target; }
public static IEnumerable <SpellSlot> Target(this IEnumerable <SpellSlot> spells, SpellTarget target) => spells.Where(spell => spell.GetSpellDescriptor().TryGetTarget() == target);