/// <summary> /// Undo move on the specified cube. /// </summary> /// <param name="cube">Cube.</param> public void Undo(Cube cube) { foreach (var mv in AllSteps.Reverse <SubMove>()) { ++NbSteps; mv.UndoStep(cube, Player, Opponent); } }
static void Main(string[] args) { Console.WriteLine("Hello World!"); Context ctx = new Context(); var buildCar = new AllSteps(ctx); buildCar.Execute(ctx); }
public void AddStep(List <T> moves) { if (moves.Count == 0) { return; } AllSteps.AddLast(new Moves <T>(moves)); CurrentStep = AllSteps.Last; }
/// <summary> /// Initializes a new instance of the <see cref="T:ChaxGame.Moves.MoveBattle"/> class. /// </summary> /// <param name="move">Move.</param> public MoveBattle(MoveBattle move) { ActionType = ActionType.Battle; Player = move.Player; Opponent = Player.GetOpponent(); Weight = move.Weight; TotalKills = move.TotalKills; Steps = move.Steps; AllSteps.AddRange(move.AllSteps); }
/// <summary> /// Initializes a new instance of the <see cref="T:ChaxGame.Moves.MoveBattle"/> class. /// </summary> /// <param name="previous">Previous.</param> /// <param name="idBefore">Identifier before.</param> /// <param name="idAfter">Identifier after.</param> public MoveBattle(MoveBattle previous, int idBefore, int idAfter) { Player = previous.Player; Opponent = Player.GetOpponent(); IdBefore = idBefore; IdAfter = idAfter; ActionType = ActionType.Battle; AllSteps.AddRange(previous.AllSteps); TotalKills = previous.TotalKills; Steps = previous.Steps + 1; }
// Automatically added generated step public void AddGeneratedStep(Step step) { if (!AllSteps.Contains(step)) { AllSteps.Add(step); MustRecalculateStepFlag = true; ToolBox.SetSellListForOneItem(step.ItemoCraft); foreach (Item.Mat mat in step.ItemoCraft.Materials) { ToolBox.SetSellListForOneItem(mat.Item); } } }
public override void RegenerateSteps() { Logger.LogDebug("REGENERATING STEPS"); SetContext(); AllSteps.Clear(); AllSteps.Add(new Step(this, 0, 45, ItemDB.BoltOfLinenCloth)); // Force precraft AllSteps.Add(new Step(this, 45, 70, ItemDB.HeavyLinenGloves, 35)); AllSteps.Add(new Step(this, 70, 75, ItemDB.ReinforcedLinenCape, 5)); AllSteps.Add(new Step(this, 75, 97, ItemDB.BoltofWoolenCloth)); // Force precraft AllSteps.Add(new Step(this, 97, 110, ItemDB.SimpleKilt, 15)); AllSteps.Add(new Step(this, 110, 125, ItemDB.DoublestitchedWoolenShoulders, 15)); AllSteps.Add(new Step(this, 125, 145, ItemDB.BoltOfSilkCloth)); // Force precraft AllSteps.Add(new Step(this, 145, 150, ItemDB.AzureSilkHood, 5)); AllSteps.Add(new Step(this, 150, 160, ItemDB.AzureSilkHood, 15)); AllSteps.Add(new Step(this, 160, 170, ItemDB.SilkHeadband, 10)); AllSteps.Add(new Step(this, 170, 175, ItemDB.FormalWhiteShirt, 5)); AllSteps.Add(new Step(this, 175, 185, ItemDB.BoltOfMageweave)); // Force precraft AllSteps.Add(new Step(this, 185, 200, ItemDB.CrimsonSilkVest, 15)); AllSteps.Add(new Step(this, 200, 215, ItemDB.CrimsonSilkPantaloons, 15)); AllSteps.Add(new Step(this, 215, 220, ItemDB.BlackMageweaveLeggings, 5)); AllSteps.Add(new Step(this, 220, 225, ItemDB.BlackMageweaveGloves, 5)); AllSteps.Add(new Step(this, 225, 230, ItemDB.BlackMageweaveGloves, 5)); AllSteps.Add(new Step(this, 230, 250, ItemDB.BlackMageweaveHeadband, 23)); AllSteps.Add(new Step(this, 250, 260, ItemDB.BoltofRunecloth)); // Force precraft AllSteps.Add(new Step(this, 260, 280, ItemDB.RuneclothBelt, 30)); AllSteps.Add(new Step(this, 280, 295, ItemDB.RuneclothGloves, 20)); AllSteps.Add(new Step(this, 295, 300, ItemDB.RuneclothHeadband, 5)); AllSteps.Add(new Step(this, 300, 325, ItemDB.BoltofNetherweave)); // Force precraft AllSteps.Add(new Step(this, 325, 340, ItemDB.NetherweavePants, 20)); AllSteps.Add(new Step(this, 340, 350, ItemDB.NetherweaveRobe, 10)); AllSteps.Add(new Step(this, 350, 375, ItemDB.BoltofFrostweave)); AllSteps.Add(new Step(this, 375, 380, ItemDB.FrostwovenBelt, 5)); AllSteps.Add(new Step(this, 380, 385, ItemDB.FrostwovenBoots, 5)); AllSteps.Add(new Step(this, 385, 395, ItemDB.FrostwovenCowl, 15)); AllSteps.Add(new Step(this, 395, 400, ItemDB.DuskweaveBelt, 5)); AllSteps.Add(new Step(this, 400, 410, ItemDB.DuskweaveWristwraps, 10)); AllSteps.Add(new Step(this, 410, 415, ItemDB.DuskweaveGloves, 5)); AllSteps.Add(new Step(this, 415, 425, ItemDB.DuskweaveBoots, 15)); MustRecalculateStepFlag = true; HasCheckedIfWeKnowRecipeFlag = false; if (Bot.ProfileName != null) { ProfileHandler.UnloadCurrentProfile(); } }
public override void RegenerateSteps() { Logger.LogDebug("REGENERATING ENCHANTING STEPS"); SetContext(); AllSteps.Clear(); AllSteps.Add(new Step(this, 0, 50, ItemDB.EnchantBracerMinorHealth, 20)); AllSteps.Add(new Step(this, 50, 75, ItemDB.EnchantBracerMinorHealth, 20)); AllSteps.Add(new Step(this, 75, 90, ItemDB.EnchantBracerMinorHealth, 20)); AllSteps.Add(new Step(this, 90, 120, ItemDB.EnchantBracerMinorStamina, 30)); MustRecalculateStepFlag = true; HasCheckedIfWeKnowRecipeFlag = false; if (Bot.ProfileName != null) { ProfileHandler.UnloadCurrentProfile(); } }
private void SetPendingStep() { List <Step> possibleSteps = new List <Step>(); //go trough all of them and filter for conditions foreach (Step s in AllSteps.Where(x => !x.Taken)) { List <char> preconditions = s.PreConditionSteps.Select(x => x.Name).ToList(); bool allConditionsGood = true; foreach (char condition in preconditions) { if (!OrderedSteps.Contains(condition)) { allConditionsGood = false; } } if (allConditionsGood) { possibleSteps.Add(s); } } PendingStep = possibleSteps.OrderBy(p => p.Underprogress).ThenBy(s => s.Name).FirstOrDefault(); if (PendingStep == null) { //Add steps with no parents to list, if they are still there //My mistake was here, thought, that parentless steps should be done as soon as they are alpabetically next List <Step> parentlessSteps = AllSteps.Where(s => !s.Taken && s.PreConditionSteps.Count < 1).OrderBy(s => s.Name).ToList(); PendingStep = parentlessSteps.OrderBy(s => s.Name).FirstOrDefault(); //parentlessSteps.Add(nextStep); } if (PendingStep == null) { return; } if (PendingStep.Underprogress) { MoveTime(); SetPendingStep(); } }
public void RemoveLast() { AllSteps.RemoveLast(); CurrentStep = AllSteps.Last; }
class Step2 { public Step2(AllSteps steps) { steps.Step2 = this; }
class Step3 { public Step3(AllSteps steps) { steps.Step3 = this; }
class Step1 { public Step1(AllSteps steps) { steps.Step1 = this; }