internal virtual void PreProcessInput(GamePlayerInput gamePlayerInput, float gameTime) { if (SpecialMove != null) { SpecialMove.PreProcessInput(gamePlayerInput); } }
public bool DoChoosenAttack() { if (m_Mobile == null) { return(false); } SpecialMove special = SpecialMove.GetCurrentMove(m_Mobile); if (special != null) { return(false); } else if (m_NextCastTime < DateTime.UtcNow) { if (m_Mobile.Hidden) { special = GetHiddenSpecialMove(); } else { special = GetSpecialMove(); } SpecialMove.SetCurrentMove(m_Mobile, special); m_NextCastTime = DateTime.UtcNow + GetCastDelay(); return(true); } return(false); }
public static bool SetCurrentAbility(Mobile m, WeaponAbility a) { if (!Core.AOS) { ClearCurrentAbility(m); return(false); } if (!IsWeaponAbility(m, a)) { ClearCurrentAbility(m); return(false); } if (a != null && !a.Validate(m)) { ClearCurrentAbility(m); return(false); } if (a == null) { m_Table.Remove(m); } else { SpecialMove.ClearCurrentMove(m); m_Table[m] = a; } return(true); }
public SpecialMoveFailedEventArgs(IFighter executor, IFighter target, SpecialMove move, SpecialMoveFailedReasonType reason) { Executor = executor; MoveTarget = target; Move = move; Reason = reason; }
public override void AlterMeleeDamageTo(Mobile to, ref int damage) { if (to is BaseCreature) { damage *= 10; } // little complex math here. 0 = nothing, // 1 = air 1st hit, 2 = air 2nd hit, 3 = air 3rd hit, 4 = air combo. // and so on. if (OnCombo == 0) { OnCombo = (Utility.Random(6) * 4) + 1; } // This system works fine for pure element combos. int oncombo = OnCombo / 4; if (OnCombo % 4 == 0) // On Finisher { OnCombo = 0; } else { ++OnCombo; } SpecialMove.SetCurrentMove(this, new MonkStrike((MonkElement)oncombo)); // TODO support mixed elements. }
public override void OnThink() { base.OnThink(); if (Combatant == null) { return; } if (Core.TickCount - _NextMastery >= 0) { object spell = GetMasterySpell(); if (spell == null) { return; } if (spell is SkillMasterySpell && !SkillMasterySpell.HasSpell(this, ((SkillMasterySpell)spell).GetType())) { ((SkillMasterySpell)spell).Cast(); _NextMastery = Core.TickCount + (int)TimeSpan.FromSeconds(Utility.RandomMinMax(15, 30)).TotalMilliseconds; } else if (spell is SpecialMove) { SpecialMove.SetCurrentMove(this, (SpecialMove)spell); _NextMastery = Core.TickCount + (int)TimeSpan.FromSeconds(Utility.RandomMinMax(15, 30)).TotalMilliseconds; } } }
public Move(Piece piece, Position from, int toPhysicalX, int toPhysicalY) { SpecialMove = SpecialMove.None; Piece = piece; From = from; To = new Position(toPhysicalX, toPhysicalY); }
public Move(Piece piece, Point physicalFrom, Point physicalTo) { SpecialMove = SpecialMove.None; Piece = piece; From = new Position(physicalFrom.X, physicalFrom.Y); To = new Position(physicalTo.X, physicalTo.Y); }
public static bool SetCurrentAbility(Mobile m, WeaponAbility a) { if (!IsWeaponAbility(m, a)) { ClearCurrentAbility(m); return(false); } if (m.Spell != null) { m.SendLocalizedMessage(1063024); // You cannot perform this special move right now. ClearCurrentAbility(m); return(false); } if (a != null && !a.Validate(m)) { ClearCurrentAbility(m); return(false); } if (a == null) { m_Table.Remove(m); } else { SpecialMove.ClearCurrentMove(m); m_Table[m] = a; } return(true); }
public Move(Piece piece, Position from, Position to) { SpecialMove = SpecialMove.None; Piece = piece; From = from; To = to; }
/// <summary> /// Takes a <see cref="SaveData.SpecialMoveSaveData"/> and converts it to a <see cref="SpecialMove"/> for use in game. /// </summary> /// <param name="serializedMove"> The serializable <see cref="SaveData.SpecialMoveSaveData"/> move. </param> /// <returns> <see cref="SpecialMove"/> instance for use in game.</returns> public SpecialMove SerializableToSpecialMove(SaveData.SpecialMoveSaveData serializedMove) { Type type = Type.GetType(serializedMove.typeOfSpecialMove); SpecialMove moveToLoad = (SpecialMove)Activator.CreateInstance(type, serializedMove.text, serializedMove.desc, serializedMove.magic, serializedMove.special); return(moveToLoad); }
public override void Update(float deltaTime) { base.Update(deltaTime); if (avatar != null) { avatar.Update(deltaTime); } if (SpecialMove != null) { SpecialMove.TickSpecialMove(deltaTime); } bool disableMovement = (SpecialMove != null && SpecialMove.DisableMovement); if (!disableMovement) { this.Move(GameEngine.EngineInstance.GameLevel, deltaTime); // 将controller的空间信息同步给NActor TargetActor.Location = this.Location; } // 更新角色朝向 bool disableRotation = (SpecialMove != null && SpecialMove.DisableRotation); if (!disableRotation) { UpdateTargetRotation(deltaTime); } }
/// <summary> /// Called in BaseWeapon, intended as a melee/ranged hit /// </summary> /// <param name="attacker"></param> /// <param name="defender"></param> /// <param name="damage"></param> public static void OnHit(Mobile attacker, Mobile defender, ref int damage) { if (attacker == null || defender == null) { return; } foreach (SkillMasterySpell spell in EnumerateSpells(attacker)) { spell.OnHit(defender, ref damage); } foreach (SkillMasterySpell spell in EnumerateSpells(defender)) { spell.OnGotHit(defender, ref damage); } SkillMasteryMove move = SpecialMove.GetCurrentMove(defender) as SkillMasteryMove; if (move != null) { move.OnGotHit(attacker, defender, ref damage); } if (attacker is BaseCreature || defender is BaseCreature) { CombatTrainingSpell.OnCreatureHit(attacker, defender, ref damage); } }
public override void OnThink() { base.OnThink(); if (Combatant == null) { return; } if (_NextMastery < DateTime.UtcNow) { if (SkillMasterySpell.HasSpell(this, typeof(RampageSpell)) || Utility.RandomDouble() > 0.5) { SpecialMove.SetCurrentMove(this, SpellRegistry.GetSpecialMove(740)); } else { SkillMasterySpell spell = new RampageSpell(this, null); spell.Cast(); } _NextMastery = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(45, 70)); } if (_NextSpecial < DateTime.UtcNow) { DoSpecial(); _NextSpecial = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(45, 60)); } }
/// <summary> /// Called in Aos.cs, should include all damage types /// </summary> /// <param name="victim"></param> /// <param name="damager"></param> /// <param name="damage"></param> public static void OnCasterDamaged(Mobile victim, Mobile damager, ref int damage) { if (victim == null) { return; } CheckTable(victim); if (m_Table.ContainsKey(victim)) { foreach (SkillMasterySpell sp in EnumerateSpells(victim)) { if (sp.DamageCanDisrupt && damage > sp.DamageThreshold) { sp.Expire(true); } sp.OnDamaged(damager, damage); } } SkillMasteryMove move = SpecialMove.GetCurrentMove(victim) as SkillMasteryMove; if (move != null) { move.OnDamaged(damager, victim, damage); } CombatTrainingSpell.CheckDamage(damager, victim, ref damage); }
public override bool DoActionCombat() { base.DoActionCombat(); Mobile c = m_Mobile.Combatant as Mobile; if (c != null) { SpecialMove move = SpecialMove.GetCurrentMove(m_Mobile); if (move == null && m_NextSpecial < DateTime.UtcNow && 0.05 > Utility.RandomDouble()) { move = GetSpecialMove(); if (move != null) { SpecialMove.SetCurrentMove(m_Mobile, move); m_NextSpecial = DateTime.UtcNow + GetCastDelay(); } } else if (m_Mobile.Spell == null && m_NextCastTime < DateTime.UtcNow && 0.05 > Utility.RandomDouble()) { Spell spell = GetRandomSpell(); if (spell != null) { spell.Cast(); m_NextCastTime = DateTime.UtcNow + GetCastDelay(); } } } return(true); }
private static void Targeted_Spell(TargetedSpellEventArgs e) { try { Mobile from = e.Mobile; if (!DesignContext.Check(from)) { return; // They are customizing } Spellbook book = null; int spellID = e.SpellID; if (book == null || !book.HasSpell(spellID)) { book = Find(from, spellID); } if (book != null && book.HasSpell(spellID)) { SpecialMove move = SpellRegistry.GetSpecialMove(spellID); if (move != null) { SpecialMove.SetCurrentMove(from, move); } else { Mobile to = World.FindMobile(e.Target.Serial); Item toI = World.FindItem(e.Target.Serial); Spell spell = SpellRegistry.NewSpell(spellID, from, null); if (to != null) { spell.InstantTarget = to; } else if (toI != null) { spell.InstantTarget = toI as IDamageableItem; } if (spell != null) { spell.Cast(); } else if (!Server.Spells.SkillMasteries.MasteryInfo.IsPassiveMastery(spellID)) { from.SendLocalizedMessage(502345); // This spell has been temporarily disabled. } } } else { from.SendLocalizedMessage(500015); // You do not have that spell! } } catch { } }
public Player(string name, int level, int health, int attack, int defence, int maximumMagic, int magic, int luck, int speed, int exp, Item item, SpecialMove special1, SpecialMove special2, Texture2D image = null) : base(name, level, health, attack, defence, maximumMagic, magic, luck, speed, special1, special2, image) { this.exp = exp; setExpToNextLevel(); this.item = item; }
private void checkPanelMagicSpell(SpecialMove specialMove, GameObject containerObject) { Text desc = containerObject.transform.Find("Desc").GetComponent <Text> (); Assert.AreEqual(specialMove.Desc, desc.text); Text magic = containerObject.transform.Find("Magic").GetComponent <Text> (); Assert.AreEqual("Magic: " + specialMove.Magic, magic.text); }
public override Tuple <Coord, Coord, SpecialMove> chooseMove(List <Move> moves) { Move choice = moves[rng.Next(moves.Count)]; Coord from = new Coord(choice.agent.tile.pos.row, choice.agent.tile.pos.col); Coord to = new Coord(choice.to.pos.row, choice.to.pos.col); SpecialMove special = choice.special; return(Tuple.Create(from, to, special)); }
public override Tuple <Coord, Coord, SpecialMove> chooseMove(List <Move> moves) { Move choice = null; foreach (Move m in moves) { var b2 = b.clone(); b2.move(m.from.pos, m.to.pos, m.special); if (b2.state == GameState.BlackVictory && playerColor == Color.Black || b2.state == GameState.WhiteVictory && playerColor == Color.White) { choice = m; break; } } bool captureFound = false; foreach (Move m in moves) { if (!captureFound && m.removeMe != null) { captureFound = true; choice = m; } else if (m.removeMe != null && m.removeMe.GetType() == typeof(Queen)) { choice = m; } else if (m.removeMe != null && m.removeMe.GetType() == typeof(Rook)) { choice = m; } else if (m.removeMe != null && m.removeMe.GetType() == typeof(Bishop)) { choice = m; } else if (m.removeMe != null && m.removeMe.GetType() == typeof(Knight)) { choice = m; } else if (m.removeMe != null && m.removeMe.GetType() == typeof(Pawn)) { choice = m; } } if (choice == null) { choice = moves[rng.Next(moves.Count)]; } Coord from = new Coord(choice.agent.tile.pos.row, choice.agent.tile.pos.col); Coord to = new Coord(choice.to.pos.row, choice.to.pos.col); SpecialMove special = choice.special; return(Tuple.Create(from, to, special)); }
private bool PerformFocusAttack() { if (Utility.RandomBool() && CanUseAbility(60.0, 20, focusChance)) { SpecialMove.SetCurrentMove(m_Mobile, new FocusAttack()); return(true); } return(false); }
private bool PerformFocusAttack() { if (Utility.RandomBool() && CanUseAbility(60.0, 20, focusChance)) { SpecialMove.SetCurrentMove(m_Mobile, SpellRegistry.GetSpecialMove(500)); // Focus Attack return(true); } return(false); }
public AssassinSkillsGump(Mobile m) : base(0, 0) { Closable = true; Disposable = true; Dragable = true; Resizable = false; AddPage(0); AddBackground(0, 0, 300, 186, 9390); AddLabel(80, 7, 1193, "Assassin's Skills"); AddLabel(20, 30, 1193, "Assassinate"); AddButton(145, 35, 11400, 11402, 1, GumpButtonType.Reply, 0); AddLabel(20, 55, 1193, "Armor Ignore"); AddButton(145, 60, 11400, 11402, 2, GumpButtonType.Reply, 0); AddLabel(20, 80, 1193, "Bleed Attack"); AddButton(145, 85, 11400, 11402, 3, GumpButtonType.Reply, 0); AddLabel(20, 105, 1193, "Mortal Strike"); AddButton(145, 110, 11400, 11402, 4, GumpButtonType.Reply, 0); AddLabel(20, 130, 1193, "Shadow Strike"); AddButton(145, 135, 11400, 11402, 5, GumpButtonType.Reply, 0); AddLabel(200, 35, 1193, "Move"); AddBackground(190, 60, 60, 60, 9200); WeaponAbility ability = WeaponAbility.GetCurrentAbility(m); if (SpecialMove.GetContext(m, typeof(AssassinateMove))) { AddImage(198, 68, 21284, 1193); } else if (ability is ArmorIgnore) { AddImage(198, 68, 20992, 1193); } else if (ability is BleedAttack) { AddImage(198, 68, 20993, 1193); } else if (ability is MortalStrike) { AddImage(198, 68, 21000, 1193); } else if (ability is ShadowStrike) { AddImage(198, 68, 21003, 1193); } else { AddImage(198, 68, 2279); } }
private void ApplyMovesetToBoard() { var selectedChessPiece = m_selectedTile.GetChessPiece(); var moveSet = selectedChessPiece.GetMoveSetFromTile(m_selectedTile, this); m_validSpecialMove = moveSet.GetSpecialMove(); foreach (BoardPosition boardPos in moveSet.GetMoveSetPositions()) { m_validMovePositions.Add(boardPos); } }
public override bool Validate(Mobile from) { SkillMasteryMove move = SpecialMove.GetCurrentMove(from) as SkillMasteryMove; if ((move == null || move.GetType() != this.GetType()) && !CheckCooldown(from)) { return(false); } return(base.Validate(from)); }
private static void Targeted_Spell(TargetedSpellEventArgs e) { try { Mobile from = e.Mobile; if (!DesignContext.Check(from)) { return; // They are customizing } int spellID = e.SpellID; Spellbook book = Find(from, spellID); if (book != null && book.HasSpell(spellID)) { SpecialMove move = SpellRegistry.GetSpecialMove(spellID); if (move != null) { SpecialMove.SetCurrentMove(from, move); } else if (e.Target != null) { Mobile to = World.FindMobile(e.Target.Serial); Item toI = World.FindItem(e.Target.Serial); Spell spell = SpellRegistry.NewSpell(spellID, from, null); if (spell != null && !Spells.SkillMasteries.MasteryInfo.IsPassiveMastery(spellID)) { if (to != null) { spell.InstantTarget = to; } else if (toI != null) { spell.InstantTarget = toI as IDamageableItem; } spell.Cast(); } } } else { from.SendLocalizedMessage(500015); // You do not have that spell! } } catch (Exception ex) { Diagnostics.ExceptionLogging.LogException(ex); } }
/// <summary> /// Takes a <see cref="SpecialMove"/> and converts it to a <see cref="SaveData.SpecialMoveSaveData"/> format for serialization. /// </summary> /// <param name="move"> <see cref="SpecialMove"/> insatnce to serialize. </param> /// <returns> Serializable <see cref="SaveData.SpecialMoveSaveData"/> for saving.</returns> public SaveData.SpecialMoveSaveData SpecialMoveToSerializable(SpecialMove move) { SaveData.SpecialMoveSaveData moveToSave = new SaveData.SpecialMoveSaveData { typeOfSpecialMove = move.GetType().ToString(), text = move.Text, desc = move.Desc, magic = move.Magic, special = move.Special }; return(moveToSave); }
/// <summary> /// A function called by <see cref="updateAttacksPanel"/> that updates the display for a passed in special move /// </summary> /// <param name="UI">The containing object for the special move UI description</param> /// <param name="specialMove">The special move to provide details for</param> /// <param name="magic">The amount of magic the player has left, so that the button can be disabled /// if there isn't enough magic to use that move</param> private void updateAttacksPanelHelper(GameObject UI, SpecialMove specialMove, int magic) { UI.transform.Find("Magic").GetComponent <Text> ().text = "Magic: " + specialMove.Magic.ToString(); UI.transform.Find("Desc").GetComponent <Text> ().text = specialMove.Desc; if (magic < specialMove.Magic) { UI.transform.Find("Button").GetComponent <Button> ().interactable = false; } else { UI.transform.Find("Button").GetComponent <Button> ().interactable = true; } }
public void SpecialMoveSaveLoad() { SpecialMove testMove = new MagicAttack("testtext", "testdesc", 1, 1.2f); SaveData.SpecialMoveSaveData savedItem = PlayerData.instance.data.SpecialMoveToSerializable(testMove); SpecialMove restoredMove = PlayerData.instance.data.SerializableToSpecialMove(savedItem); Assert.IsInstanceOf <MagicAttack>(restoredMove); Assert.AreEqual(testMove.Desc, restoredMove.Desc); Assert.AreEqual(testMove.Text, restoredMove.Text); Assert.AreEqual(testMove.Magic, restoredMove.Magic); Assert.AreEqual(testMove.Special, restoredMove.Special); }
public void DoMoveMeleeAttack() { specialMove = SpecialMove.SM_MeleeAttack; bCanMove = false; // TODO: animation }
protected override void InitializeActor() { base.InitializeActor(); world = FindObjectOfType<WorldManager>(); if(world == null) { Debug.Log("ERROR! "+name+" couldn't find the WorldManager on initialization!"); } // Store all anim info to be set in the animator at the end of the frame cachedAnimData = new CachedAnimData(); cachedAnimData.transperency = 1.0f; movementComp = GetComponent<CharacterMover>(); if(movementComp == null) { Debug.Log("WARNING! "+name+" :: Doesn't have a movement component!"); } animator = GetComponent<Animator>(); if(animator == null) { Debug.Log("WARNING! "+name+" :: Doesn't have an animator!"); } animator.logWarnings = false; // Add the blood particle effect at init b/c its so frequently used. The others are added as needed if(bDoesConditionEffects && bloodEffectsPrototype != null) { bloodEffectSystem = AddEffectAttached(bloodEffectsPrototype, Vector3.zero); } health = baseHealth; cachedAnimData.mirroring = Facing.right; bIsDead = false; specialMove = SpecialMove.SM_None; if(!bCanModifyVisibilty) { visibility = MAX_VISIBILITY; } // Ability sets abilities = new List<Ability>(); abilitiesInUse = new List<Ability>(); pendingAbilities = new Queue<Ability>(); // Create the effect heuristic: The effect classes apear in the same order as the effects enum activeEffects = new Effect[NUM_EFFECTS]; activeEffects[(int)EffectType.Burning] = new Effect_HealthDrain(this, EffectType.Burning, 50, 0.3f); activeEffects[(int)EffectType.Bleeding] = new Effect_HealthDrain(this, EffectType.Bleeding, 10, 0.5f); activeEffects[(int)EffectType.Broken] = new Effect_Broken(this, EffectType.Broken); activeEffects[(int)EffectType.Knockdown] = new Effect_Knockdown(this, EffectType.Knockdown); activeEffects[(int)EffectType.Dazed] = new Effect_Daze(this, EffectType.Dazed); activeEffects[(int)EffectType.Poison] = new Effect_HealthDrain(this, EffectType.Poison, 25, 0.5f); activeEffects[(int)EffectType.Blind] = new Effect_Blind(this, EffectType.Blind); // One resistance stat for each effect type resistances = new float[NUM_EFFECTS]; for(int i = 0; i < resistances.Length; i++) { resistances[i] = 0.0f; } // Stat Table: starts out 0'd //stats = new int[NUM_STATS]; //for(int i = 0; i < stats.Length; i++) { // stats[i] = 0; //} inventory = new Inventory(INVENTORY_SIZE); // Just set default attack location to be the torso attackTargetLocation = BodyPart.Torso; nearbyDrops = new List<DroppedItem>(); // Search all children transforms for the shadow one if(transform.childCount > 0) { for(int i = 0; i < transform.childCount; i++) { if(transform.GetChild(i).GetComponent<SpriteRenderer>()) { shadowTransform = transform.GetChild(i); break; } } } }
public void EndMoveThrow() { specialMove = SpecialMove.SM_None; bCanMove = true; cachedAnimData.throwing = false; }
public void EndMoveMeleeAttack() { specialMove = SpecialMove.SM_None; bCanMove = true; // TODO: animation }
public void EndMoveHidden() { specialMove = SpecialMove.SM_None; cachedAnimData.transperency = 1.0f; }
public void EndMoveCrouch() { specialMove = SpecialMove.SM_None; bCanMove = true; cachedAnimData.crouch = false; }
public void EndMoveAttack() { specialMove = SpecialMove.SM_None; bCanMove = true; }
public void DoMoveThrow() { specialMove = SpecialMove.SM_Throw; bCanMove = false; cachedAnimData.throwing = true; }
public void DoMoveHidden(float transparencyPct) { specialMove = SpecialMove.SM_Hidden; cachedAnimData.transperency = transparencyPct; }
public void DoMoveCrouch() { specialMove = SpecialMove.SM_Crouch; bCanMove = false; cachedAnimData.crouch = true; }
public void DoMoveAttack() { specialMove = SpecialMove.SM_Attack; bCanMove = false; cachedAnimData.bFlagAttack = true; }