public bool enoughMP(Magics magic) { if (this.MP >= (int)magic) { return(true); } return(false); }
public Stoune(double x, double y, double width, double height, WarUnit thrower, int range, int TakeLife, int timeOut, SpriteType spriteType, Magics magicType, Vector2 dir, double speed ) : base(x, y, width, height, thrower, range, TakeLife, timeOut, spriteType, magicType) { this.Direction = dir; this.Speed = speed; }
public virtual Reaction reactToWeapon(Magics typeOfMagic) { switch (typeOfMagic) { case Magics.TakeLife: return(Reaction.ReceiveDemage); break; case Magics.GiveLife: return(Reaction.ReceiveLife); break; default: return(Reaction.Passive); } }
/// <summary> /// Initializes chess with the custom fen. /// </summary> public void InitializeChess(string FEN) { Magics.Init(); //Initialize magics ;) Zobrist.Init(); //Initiliaze zobrist MvvLva.Init(); //Initialize chess board = new Board(FEN); Moves = new SMove[256]; search = new AI(board); OnTurnSwitched(64, 64); //Call it on start }
public override void Die() { base.Die(); if (Player?.Node == null) { return; } List <MapObject> targets = Player.GetTargets(CurrentMap, CurrentLocation, 2); foreach (MapObject target in targets) { Player.ActionList.Add(new DelayedAction( SEnvir.Now.AddMilliseconds(800), ActionType.DelayedMagicDamage, Magics.ToList(), target, Functions.InRange(target.CurrentLocation, CurrentLocation, 1), DarkStoneStats, 0)); } Effect effect = Effect.Puppet; if (DarkStoneStats.GetAffinityValue(Element.Fire) > 0) { effect = Effect.PuppetFire; } else if (DarkStoneStats.GetAffinityValue(Element.Ice) > 0) { effect = Effect.PuppetIce; } else if (DarkStoneStats.GetAffinityValue(Element.Lightning) > 0) { effect = Effect.PuppetLightning; } else if (DarkStoneStats.GetAffinityValue(Element.Wind) > 0) { effect = Effect.PuppetWind; } Broadcast(new S.ObjectEffect { Effect = effect, ObjectID = ObjectID }); DeadTime = SEnvir.Now.AddSeconds(2); }
public Magic(double x, double y, double width, double height, WarUnit thrower, int range, int takeLife, int timeOut, SpriteType spriteType, Magics magicType ) : base(x, y, width, height) { this.MagicThrower = thrower; this.Range = range; this.CurrentTimeout = 0; this.TimeOut = timeOut; this.HasTimeout = false; this.SpriteType = spriteType; this.X -= this.Width / 2 - 20; this.Y -= this.Height / 2 - 20; this.MagicType = magicType; this.TakeLife = takeLife; }
public OrderedDictionary <byte, byte> CloneMagic() => Magics.Clone();
private static void AddMovesFromSquare(MagicMoveTableBuilder builder, int srcFile, int srcRank) { ulong mask = 0; List <ulong> occupancies = new List <ulong>(); List <ulong> moves = new List <ulong>(); // populate mask // Note: mask rays don't extend to the edge of the map; this is because if a ray reaches all the way to the edge of the board, that square's occupancy doesn't affect move generation. // up/left for (int i = 1;; i++) { int dstFile = srcFile - i; int dstRank = srcRank + i; if (!InsideOuterRing(dstFile, dstRank)) { break; } mask |= Position.ValueFromFileRank(dstFile, dstRank); } // up/right for (int i = 1; ; i++) { int dstFile = srcFile + i; int dstRank = srcRank + i; if (!InsideOuterRing(dstFile, dstRank)) { break; } mask |= Position.ValueFromFileRank(dstFile, dstRank); } // down/left for (int i = 1; ; i++) { int dstFile = srcFile - i; int dstRank = srcRank - i; if (!InsideOuterRing(dstFile, dstRank)) { break; } mask |= Position.ValueFromFileRank(dstFile, dstRank); } // down/right for (int i = 1; ; i++) { int dstFile = srcFile + i; int dstRank = srcRank - i; if (!InsideOuterRing(dstFile, dstRank)) { break; } mask |= Position.ValueFromFileRank(dstFile, dstRank); } int maskBits = Bits.PopCount(mask); int maskPermutations = 1 << maskBits; for (int permutation = 0; permutation < maskPermutations; permutation++) { ulong occupancy = Bits.ParallelBitDeposit((ulong)permutation, mask); ulong singularMoves = 0; // Note: rays do now reach all the way to the edge of the board; we do want to generate moves that would reach the end of the board. // up/left for (int i = 1; ; i++) { int dstFile = srcFile - i; int dstRank = srcRank + i; if (!Position.FileRankOnBoard(dstFile, dstRank)) { break; } ulong move = Position.ValueFromFileRank(dstFile, dstRank); singularMoves |= move; if ((occupancy & move) > 0) { break; } } // up/right for (int i = 1; ; i++) { int dstFile = srcFile + i; int dstRank = srcRank + i; if (!Position.FileRankOnBoard(dstFile, dstRank)) { break; } ulong move = Position.ValueFromFileRank(dstFile, dstRank); singularMoves |= move; if ((occupancy & move) > 0) { break; } } // down/left for (int i = 1; ; i++) { int dstFile = srcFile - i; int dstRank = srcRank - i; if (!Position.FileRankOnBoard(dstFile, dstRank)) { break; } ulong move = Position.ValueFromFileRank(dstFile, dstRank); singularMoves |= move; if ((occupancy & move) > 0) { break; } } // down/right for (int i = 1; ; i++) { int dstFile = srcFile + i; int dstRank = srcRank - i; if (!Position.FileRankOnBoard(dstFile, dstRank)) { break; } ulong move = Position.ValueFromFileRank(dstFile, dstRank); singularMoves |= move; if ((occupancy & move) > 0) { break; } } occupancies.Add(occupancy); moves.Add(singularMoves); } var ix = Position.IxFromFileRank(srcFile, srcRank); var info = new MagicMoveTable.Info { Magic = Magics.GetOrDefault(ix), Mask = mask, MaskedOccupancyKeys = occupancies.ToArray(), MovesValues = moves.ToArray(), }; builder.Add(ix, info); }
public override void Load(BinaryReader reader, int version, int customVersion) { Index = reader.ReadInt32(); Name = reader.ReadString(); Level = reader.ReadUInt16(); Class = (MirClass)reader.ReadByte(); Gender = (MirGender)reader.ReadByte(); Hair = reader.ReadByte(); CreationDate = DateTime.FromBinary(reader.ReadInt64()); Deleted = reader.ReadBoolean(); DeleteDate = DateTime.FromBinary(reader.ReadInt64()); HP = reader.ReadInt32(); MP = reader.ReadInt32(); Experience = reader.ReadInt64(); int count = reader.ReadInt32(); Array.Resize(ref Inventory, count); for (int i = 0; i < count; i++) { if (!reader.ReadBoolean()) { continue; } UserItem item = new UserItem(reader, version, customVersion); if (Envir.BindItem(item) && i < Inventory.Length) { Inventory[i] = item; } } count = reader.ReadInt32(); for (int i = 0; i < count; i++) { if (!reader.ReadBoolean()) { continue; } UserItem item = new UserItem(reader, version, customVersion); if (Envir.BindItem(item) && i < Equipment.Length) { Equipment[i] = item; } } count = reader.ReadInt32(); for (int i = 0; i < count; i++) { UserMagic magic = new UserMagic(reader, version, customVersion); if (magic.Info == null) { continue; } magic.CastTime = int.MinValue; Magics.Add(magic); } if (version > 99) { AutoPot = reader.ReadBoolean(); Grade = reader.ReadByte(); HPItemIndex = reader.ReadInt32(); MPItemIndex = reader.ReadInt32(); AutoHPPercent = reader.ReadByte(); AutoMPPercent = reader.ReadByte(); } if (version > 101) { SealCount = reader.ReadUInt16(); } }
public FireBall(double x, double y, double width, double height, WarUnit thrower, int range, int TakeLife, int timeOut, SpriteType spriteType, Magics magicType ) : base(x, y, width, height, thrower, range, TakeLife, timeOut, spriteType, magicType) { }