/// <summary> /// Removes the given item from the collection /// </summary> /// <returns>True, if the item was removed, otherwise False</returns> /// <param name="item">The item that should be removed</param> public override bool Remove(IModelElement item) { if ((this._parent.CertificationPeriod == item)) { this._parent.CertificationPeriod = null; return(true); } if ((this._parent.ErpPerson == item)) { this._parent.ErpPerson = null; return(true); } ICraft craftItem = item.As <ICraft>(); if (((craftItem != null) && this._parent.Crafts.Remove(craftItem))) { return(true); } IQualificationRequirement qualificationRequirementItem = item.As <IQualificationRequirement>(); if (((qualificationRequirementItem != null) && this._parent.QualificationRequirements.Remove(qualificationRequirementItem))) { return(true); } return(false); }
/// <summary> /// Adds the given element to the collection /// </summary> /// <param name="item">The item to add</param> public override void Add(IModelElement item) { if ((this._parent.CertificationPeriod == null)) { IDateTimeInterval certificationPeriodCasted = item.As <IDateTimeInterval>(); if ((certificationPeriodCasted != null)) { this._parent.CertificationPeriod = certificationPeriodCasted; return; } } if ((this._parent.ErpPerson == null)) { IErpPerson erpPersonCasted = item.As <IErpPerson>(); if ((erpPersonCasted != null)) { this._parent.ErpPerson = erpPersonCasted; return; } } ICraft craftsCasted = item.As <ICraft>(); if ((craftsCasted != null)) { this._parent.Crafts.Add(craftsCasted); } IQualificationRequirement qualificationRequirementsCasted = item.As <IQualificationRequirement>(); if ((qualificationRequirementsCasted != null)) { this._parent.QualificationRequirements.Add(qualificationRequirementsCasted); } }
/// <summary> /// Removes the given item from the collection /// </summary> /// <returns>True, if the item was removed, otherwise False</returns> /// <param name="item">The item that should be removed</param> public override bool Remove(IModelElement item) { IWorkTask workTaskItem = item.As <IWorkTask>(); if (((workTaskItem != null) && this._parent.WorkTasks.Remove(workTaskItem))) { return(true); } if ((this._parent.ValidityInterval == item)) { this._parent.ValidityInterval = null; return(true); } if ((this._parent.Crew == item)) { this._parent.Crew = null; return(true); } ICraft craftItem = item.As <ICraft>(); if (((craftItem != null) && this._parent.Crafts.Remove(craftItem))) { return(true); } if ((this._parent.Status == item)) { this._parent.Status = null; return(true); } return(false); }
public string ExecuteAction(ICraft craft, ICrafter crafter, List<IModifier> activeModifiers, Random rng, Conditions condition) { string result = String.Empty; //Success! wasSuccessful = true; result = ActionName + " used! " + Math.Abs(DurabilityUsed) + " durability restored."; craft.IncrementStep(); craft.UpdateDurability(DurabilityUsed); crafter.UpdateCP(CPCost); this.actionUsed = true; return result; }
static void Main(string[] args) { ICozyGodEngine engine = new CozyGodEngine(); engine.Init(); ICraft i = engine.GetCraft(); Card a = null; Card b = null; ICardLibrary lib = engine.GetCardLibrary(); while (true) { string input = System.Console.ReadLine(); string[] craftCard = input.Split(','); if (craftCard.Length < 2) { System.Console.WriteLine("Input Error, \"name,name\""); continue; } a = lib.FindCardByName(craftCard[0]); b = lib.FindCardByName(craftCard[1]); if (a != null && b != null) { System.Console.Write("card : {0}, level : {1} + card : {2}, card level : {3} = " , a.Name, a.Level, b.Name, b.Level); } else { System.Console.Write("Some card has no fond."); continue; } Card cardRet = null; if (i.TryCraft(a, b)) { cardRet = i.Craft(a, b); } else { System.Console.WriteLine("null"); continue; } System.Console.WriteLine("card : {0}, level : {1}", cardRet.Name, cardRet.Level); } }
public string ExecuteAction(ICraft craft, ICrafter crafter, List<IModifier> activeModifiers, Random rng, Conditions condition) { string result = String.Empty; //Success! wasSuccessful = true; double progress = Calc.Progress(craft.RecipeLevel, craft.ItemLevel, crafter.CrafterLevel, crafter.Craftsmanship) * ProgressModifier; result = ActionName + " successful! Progress increased by " + Math.Round(progress, 0, MidpointRounding.ToEven); craft.UpdateProgress(progress); craft.IncrementStep(); craft.UpdateDurability(DurabilityUsed); crafter.UpdateCP(CPCost); this.actionUsed = true; return result; }
/// <summary> /// Adds the given element to the collection /// </summary> /// <param name="item">The item to add</param> public override void Add(IModelElement item) { IWorkTask workTasksCasted = item.As <IWorkTask>(); if ((workTasksCasted != null)) { this._parent.WorkTasks.Add(workTasksCasted); } if ((this._parent.ValidityInterval == null)) { IDateTimeInterval validityIntervalCasted = item.As <IDateTimeInterval>(); if ((validityIntervalCasted != null)) { this._parent.ValidityInterval = validityIntervalCasted; return; } } if ((this._parent.Crew == null)) { ICrew crewCasted = item.As <ICrew>(); if ((crewCasted != null)) { this._parent.Crew = crewCasted; return; } } ICraft craftsCasted = item.As <ICraft>(); if ((craftsCasted != null)) { this._parent.Crafts.Add(craftsCasted); } if ((this._parent.Status == null)) { IStatus statusCasted = item.As <IStatus>(); if ((statusCasted != null)) { this._parent.Status = statusCasted; return; } } }
public void Init() { config = new GameConfigImpl(); string contextPath; if (!config.TryGetStringConfig(StringConfigEnum.ContentPath, out contextPath)) { return; } cardLibrary = new CardLibraryImpl(contextPath + "/Data/card.json"); var c = new CraftImpl(); c.Init(this); craft = c; var raf = new RaffleImpl(); raf.Init(this); raffle = raf; }
public Quality GetQuality(IGameObject obj) { Ingredient ingredient = obj as Ingredient; if (ingredient != null) { return(ingredient.GetQuality()); } else { ICraft craft = obj as ICraft; if (craft != null) { return(craft.GetQuality()); } else { IFoodContainer food = obj as IFoodContainer; if (food != null) { return(food.FoodQuality); } else { IHarvestable harvestable = obj as IHarvestable; if (harvestable != null) { return(harvestable.GetQuality()); } else { return(Quality.Neutral); } } } } }
public void AtEndOfStep(ICrafter crafter, ICraft craft) { if(stepsRemaining > 0) { //Don't give cp back on first step if(!(stepsRemaining > StepsActive)) { crafter.UpdateCP(DurabilityReturned * -1); } stepsRemaining--; } }
public string ApplyModifier(ICrafter crafter, ICraft craft) { crafter.UpdateCP(CPCost); craft.SetItemLevel(Calc.GetIngenuityIIItemLevels(craft.ItemLevel)); return ModifierName + " is applied. Item Level is now " + craft.ItemLevel; }
public string ExecuteAction(ICraft craft, ICrafter crafter, List<IModifier> activeModifiers, Random rng, Conditions condition) { string result = String.Empty; if (condition == Conditions.Good || condition == Conditions.Excellent) { //Calculate success. if (Calc.ActionIsSuccessful(rng, SuccessChance)) { //Success! wasSuccessful = true; double quality = Calc.ApplyCondition(Calc.Quality(craft.RecipeLevel, craft.ItemLevel, crafter.CrafterLevel, crafter.Control) * qualityModifier, condition); result = ActionName + " successful! Quality increased by " + Math.Round(quality, 0, MidpointRounding.ToEven); //Update quality. craft.UpdateQuality(quality); } else { //Failure! wasSuccessful = false; result = ActionName + " failed!"; } craft.IncrementStep(); craft.UpdateDurability(DurabilityUsed); crafter.UpdateCP(CPCost); this.actionUsed = true; } else { result = "Condition must be good or excellent to use Precise Touch."; } return result; }
public string ExecuteAction(ICraft craft, ICrafter crafter, List<IModifier> activeModifiers, Random rng, Conditions condition) { string result = String.Empty; if (Calc.ActionIsSuccessful(rng, SuccessChance)) { //Success! wasSuccessful = true; double progress = 40; result = ActionName + " successful! Progress increased by " + Math.Round(progress, 0, MidpointRounding.ToEven); //Update progress. craft.UpdateProgress(progress); } else { //Failure! wasSuccessful = false; result = ActionName + " failed!"; } craft.IncrementStep(); craft.UpdateDurability(DurabilityUsed); crafter.UpdateCP(CPCost); this.actionUsed = true; return result; }
public void AtEndOfStep(ICrafter crafter, ICraft craft) { if (stepsRemaining > 0) { stepsRemaining--; } }
public string ApplyModifier(ICrafter crafter, ICraft craft) { string result = String.Empty; if (craft.Step == 0) { crafter.UpdateCP(CPCost); this.stepsActive = Convert.ToInt32(Math.Ceiling((double)craft.Difficulty/100)); this.stepsRemaining = StepsActive + 1; result = ModifierName + " applied."; } else { result = ModifierName + " can only be used as the first step."; } return result; }
public string ExecuteAction(ICraft craft, ICrafter crafter, List<IModifier> activeModifiers, Random rng, Conditions condition) { string result = String.Empty; if (craft.Step == 0) { //Success! wasSuccessful = true; double progress = craft.Difficulty * 0.33; result = ActionName + " successful! Progress increased by " + Math.Round(progress, 0, MidpointRounding.ToEven); craft.UpdateProgress(progress); craft.IncrementStep(); craft.UpdateDurability(DurabilityUsed); crafter.UpdateCP(CPCost); this.actionUsed = true; } else { result = ActionName + " can only be used on the first step."; } return result; }
public void AtEndOfStep(ICrafter crafter, ICraft craft) { if (stepsRemaining > 0) { stepsRemaining--; } else { if (!controlRemoved) { crafter.IncreaseControl(crafter.BaseControl * ControlModifier * -1); controlRemoved = true; } } }
public string ApplyModifier(ICrafter crafter, ICraft craft) { crafter.UpdateCP(CPCost); crafter.IncreaseControl(crafter.BaseControl * ControlModifier); return ModifierName + " is applied. Control is now " + crafter.Control; }
public string ApplyModifier(ICrafter crafter, ICraft craft) { crafter.UpdateCP(CPCost); return ModifierName + " applied."; }
public void AtEndOfStep(ICrafter crafter, ICraft craft) { if (stepsRemaining > 0) { stepsRemaining--; } else { if (!baseItemLevelRestored) { craft.SetItemLevel(craft.BaseItemLevel); } } }
public string ExecuteAction(ICraft craft, ICrafter crafter, List<IModifier> activeModifiers, Random rng, Conditions condition) { string result = String.Empty; //If Inner Quiet active, set quality modifier. var innerQuiet = activeModifiers.Where(o => o.ModifierName == "Inner Quiet" && o.StepsRemaining > 0).FirstOrDefault() as InnerQuiet; if (innerQuiet != null && innerQuiet.StepsActive > 0) { //Calculate success. if (Calc.ActionIsSuccessful(rng, SuccessChance)) { //Success! wasSuccessful = true; qualityModifier = qualityModifier * (1 + (innerQuiet.StepsActive * .2)); double quality = Calc.ApplyCondition(Calc.Quality(craft.RecipeLevel, craft.ItemLevel, crafter.CrafterLevel, crafter.Control) * qualityModifier, condition); result = ActionName + " successful! Quality increased by " + Math.Round(quality, 0, MidpointRounding.ToEven); //Update quality. craft.UpdateQuality(quality); } else { //Failure! wasSuccessful = false; result = ActionName + " failed!"; } craft.IncrementStep(); craft.UpdateDurability(DurabilityUsed); crafter.UpdateCP(CPCost); innerQuiet.ConsumeStacks(); this.actionUsed = true; } else { result = "Inner Quiet stacks not available, cannot use " + ActionName + "."; } return result; }
public string ExecuteAction(ICraft craft, ICrafter crafter, List<IModifier> activeModifiers, Random rng, Conditions condition) { string result = String.Empty; //Calculate success. if (Calc.ActionIsSuccessful(rng, SuccessChance)) { //Success! wasSuccessful = true; if (activeModifiers.Where(o => o.ModifierName == "Name Of Water").Count() > 0) { progressModifier = 2 * ((craft.Difficulty - craft.Progress) / craft.Difficulty - 1) + 3; } if(craft.Affinity == ElementalAffinity.Water) { progressModifier = progressModifier * 2; } double progress = Calc.Progress(craft.RecipeLevel, craft.ItemLevel, crafter.CrafterLevel, crafter.Craftsmanship) * ProgressModifier; result = ActionName + " successful! Progress increased by " + Math.Round(progress, 0, MidpointRounding.ToEven); //Update quality. craft.UpdateProgress(progress); } else { //Failure! wasSuccessful = false; result = ActionName + " failed!"; } craft.IncrementStep(); craft.UpdateDurability(DurabilityUsed); crafter.UpdateCP(CPCost); this.actionUsed = true; return result; }
public string ExecuteAction(ICraft craft, ICrafter crafter, List<IModifier> activeModifiers, Random rng, Conditions condition) { string result = String.Empty; //If Inner Quiet active, set quality modifier. var innerQuiet = activeModifiers.Where(o => o.ModifierName == "Inner Quiet" && o.StepsRemaining > 0).FirstOrDefault() as InnerQuiet; if (innerQuiet != null && innerQuiet.StepsActive > 0) { //Success! wasSuccessful = true; double cpRestored = ((21 * innerQuiet.StepsActive) - Math.Pow(innerQuiet.StepsActive, 2) + 10) / 2; result = ActionName + " successful! " + cpRestored + " CP restored!"; //Update quality. craft.IncrementStep(); craft.UpdateDurability(DurabilityUsed); crafter.UpdateCP(Convert.ToInt32(cpRestored * -1)); innerQuiet.ConsumeStacks(); this.actionUsed = true; } else { result = "Inner Quiet stacks not available, cannot use " + ActionName + "."; } return result; }
public string ExecuteAction(ICraft craft, ICrafter crafter, List<IModifier> activeModifiers, Random rng, Conditions condition) { string result = String.Empty; if (condition == Conditions.Good || condition == Conditions.Excellent) { wasSuccessful = true; result = ActionName + " successful! CP increased by 20."; craft.IncrementStep(); craft.UpdateDurability(DurabilityUsed); crafter.UpdateCP(CPCost); this.actionUsed = true; } else { result = "Condition must be good or excellent to use Tricks of the Trade."; } return result; }
public void AtEndOfStep(ICrafter crafter, ICraft craft) { if(stepsRemaining == 0 && stepsActive > 0) { crafter.IncreaseControl((crafter.BaseControl * ControlModifier) * (StepsActive - 1) * -1); stepsActive = 0; } }