//Assigns all variables public Skill(string n, string d, float effectAmnt, float c, float cd, Skills enumSkill, SkillType _type, SkillResource st, int req, StatsManager sm, bool hold) { isUnlocked = false; name = n; description = d; originalDescription = d; effectAmount = effectAmnt; cost = c; cooldown = cd; currentCooldown = cooldown; anim = GameObject.FindGameObjectWithTag("Player").GetComponent <Animator>(); CurrentEnumSkill = enumSkill; if (enumSkill < 0) { IsPassive = true; } stats = sm; lvlRequirement = req; skillResource = st; upgrades = new List <Upgrade>(); upgradeCount = 0; isHoldable = hold; hudMan = GameObject.FindGameObjectWithTag("Player").GetComponent <HUDManager>(); fillInDescriptionData(); }
/// <summary> /// Get List Skill Resource /// </summary> /// <param name="list"></param> /// <returns></returns> public List <SkillResource> GetListSkillResource(IEnumerable <Category> list) { List <SkillResource> listResult = new List <SkillResource>(); if (list.Any()) { foreach (var item in list) { SkillResource skillResource = new SkillResource { Id = item.Id, Name = item.Name, PersonCategoryId = item.PersonCategories.FirstOrDefault().Id, OrderIndex = item.PersonCategories.FirstOrDefault().OrderIndex, Technologies = new List <TechnologyResource>() }; foreach (var itemTechnology in item.Technologies) { TechnologyResource technology = new TechnologyResource { Id = itemTechnology.Id, Name = itemTechnology.Name, CategoryId = itemTechnology.CategoryId, CategoryName = item.Name }; skillResource.Technologies.Add(technology); } listResult.Add(skillResource); } } return(listResult); }
public async Task <SkillResource> AddSkillAsync(SkillResource skillResource) { var skill = _mapper.Map <SkillResource, Skill>(skillResource); var createdSkill = await _repository.AddSkillAsync(skill); await _unitOfWork.CommitAsync(); return(_mapper.Map <Skill, SkillResource>(createdSkill)); }
public async Task AddSkillAsync_SkillResourceAsParam_OkReturned() { var skillResource = new SkillResource() { Name = "Skill_3" }; var result = await _controller.AddSkillAsync(skillResource); AssertForOk(result); }
public void CopyFrom(TableConfig.Skill skill) { id = skill.id; desc = skill.desc; type = skill.type; icon = skill.icon; distance = skill.distance; duration = skill.duration; interval = skill.interval; canmove = skill.canmove; impacttoself = skill.impacttoself; impact = skill.impact; interruptPriority = skill.interruptPriority; isInterrupt = skill.isInterrupt; targetType = skill.targetType; aoeType = skill.aoeType; aoeSize = skill.aoeSize; aoeAngleOrLength = skill.aoeAngleOrLength; maxAoeTargetCount = skill.maxAoeTargetCount; dslSkillId = skill.dslSkillId; dslFile = skill.dslFile; startupSkillId = skill.startupSkillId; flybackSkillId = skill.flybackSkillId; startupPositionType = skill.startupPositionType; autoCast = skill.autoCast; needTarget = skill.needTarget; cooldown = skill.cooldown; damage = skill.damage; addhp = skill.addhp; addmp = skill.addmp; addattack = skill.addattack; adddefence = skill.adddefence; addshield = skill.addshield; addspeed = skill.addspeed; addcritical = skill.addcritical; addcriticalpow = skill.addcriticalpow; addrps = skill.addrps; subsequentSkills.Clear(); subsequentSkills.AddRange(skill.subsequentSkills); resources.Clear(); foreach (var pair in skill.resources) { SkillResource res = new SkillResource(); res.Key = pair.Key; res.Resource = pair.Value; resources.Add(res); } }
public async Task <SkillResource> UpdateSkillAsync(int id, SkillResource skillResource) { var skill = await _repository.GetSkillAsync(id); if (skill == null) { return(null); } _mapper.Map <SkillResource, Skill>(skillResource, skill); await _unitOfWork.CommitAsync(); return(_mapper.Map <Skill, SkillResource>(skill)); }
public async Task AddNewSkillAsync_SkillResourceAsParam_CreatedSkillResourceReturned() { var newSkill = new SkillResource() { Name = "New Skill" }; var addedSkill = await _service.AddSkillAsync(newSkill); Assert.AreEqual(newSkill.Name, addedSkill.Name); Assert.IsNotNull(addedSkill.Id); }
public static SkillVM Create(SkillResource resource) { Func <SkillVM> creator; if (!_creators.TryGetValue(resource.GetType(), out creator)) { throw new NotSupportedException(String.Format("{0} is not supported.", resource.GetType().Name)); } SkillVM viewModel = creator(); viewModel.Model = resource; return(viewModel); }
public async Task <IActionResult> AddSkillAsync([FromBody] SkillResource skillResource) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var createdSkill = await _skillService.AddSkillAsync(skillResource); if (createdSkill == null) { return(BadRequest()); } return(Ok(createdSkill)); }
public async Task <IActionResult> UpdateSkillAsync(int id, [FromBody] SkillResource skillResource) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var updatedSkill = await _skillService.UpdateSkillAsync(id, skillResource); if (updatedSkill == null) { return(NotFound()); } return(Ok(updatedSkill)); }
// GET: SkillResource/Delete/5 public ActionResult Delete(int id, String id2) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SkillResource sk = sc.GetMany().Where(a => a.SkillIdFK == id).Where(b => b.ResourceIdFK == id2).FirstOrDefault(); if (sk == null) { return(HttpNotFound()); } return(View(sk)); }
public ActionResult Delete(int id, SkillResource sr, String id2) { try { var req = sc.GetMany().Where(a => a.SkillIdFK == id).Where(b => b.ResourceIdFK == id2).FirstOrDefault(); sc.Delete(req); sc.Commit(); return(RedirectToAction("Index")); } catch { return(View()); } }
public void UseResource(SkillResource type, float amt, bool overTime) { switch (type) { case SkillResource.Mana: useMana(amt); break; case SkillResource.Stamina: useStamina(amt, overTime); break; case SkillResource.SkillCharge: inventoryClassRefrence.RemoveItemFromInventory(inventoryList[inventoryClassRefrence.GetIndxOfItem(0)]); break; } }
public ActionResult Create(SkillResourceModel skm) { try { SkillResource sk = new SkillResource { ResourceIdFK = skm.ResourceIdFK, SkillIdFK = skm.SkillIdFK, Level = skm.Level }; sc.Add(sk); sc.Commit(); return(RedirectToAction("Index")); } catch { return(View()); } }
public void CopyFrom(TableConfig.Skill skill) { id = skill.id; desc = skill.desc; type = skill.type; icon = skill.icon; impacttoself = skill.impacttoself; impact = skill.impact; targetType = skill.targetType; aoeType = skill.aoeType; aoeSize = skill.aoeSize; aoeAngleOrLength = skill.aoeAngleOrLength; maxAoeTargetCount = skill.maxAoeTargetCount; dslFile = skill.dslFile; resources.Clear(); foreach (var pair in skill.resources) { SkillResource res = new SkillResource(); res.Key = pair.Key; res.Resource = pair.Value; resources.Add(res); } }
public async Task <ActionResult> Create(int projectID, string projectName) { //IDAL dal = (new DALFactory()).GetInstance(); ProjectResources prjRes = new ProjectResources(); prjRes.projectId = projectID; prjRes.projectName = projectName; List <SkillResource> lstSkillResource = new List <SkillResource>(); prjRes.skillResources = lstSkillResource; InitializeServiceClient(); try { //List<ProjectSkillResource> projectSkillResources = dal.GetAllProjectSkillResourcesByProjectID(projectID); //Get the resources and their skills assigned to the selcted Project. HttpResponseMessage response = await client.PostAsJsonAsync("Project/GetAllProjectSkillResourcesByProjectID?projectID=" + projectID, req); //prjRes = await response.Content.ReadAsAsync<ProjectResources>(); List <ProjectSkillResource> projectSkillResources = await response.Content.ReadAsAsync <List <ProjectSkillResource> >(); Hashtable objHashTable = new Hashtable(); if (projectSkillResources != null && projectSkillResources.Count > 0) { foreach (var item in projectSkillResources) { if (!objHashTable.ContainsKey(item.skillId)) { objHashTable.Add(item.skillId, item.skillId); SkillResource objSkillResource = new SkillResource(); objSkillResource.skillId = item.skillId; objSkillResource.skill = item.skill; lstSkillResource.Add(objSkillResource); } } prjRes.skillResources = lstSkillResource; foreach (SkillResource skr in prjRes.skillResources) { foreach (var item in projectSkillResources) { if (skr.skillId == item.skillId) { switch (item.competencyLevel.ToUpper()) { case "NOVICE": skr.beginnerCount = item.availableResourceCount; break; case "ADVANCED BEGINNER": skr.advancedBeginnerCount = item.availableResourceCount; break; case "COMPETENT": skr.competentCount = item.availableResourceCount; break; case "PROFICIENT": skr.proficientCount = item.availableResourceCount; break; case "EXPERT": skr.expertCount = item.availableResourceCount; break; default: break; } } } } } } catch (Exception ex) { //UserManager user = (UserManager)Session["CurrentUser"]; //LogHelper.AddLog("ProjectAvailableResourceController", ex.Message, ex.StackTrace, "HCL.Academy.Web", user.EmailID); TelemetryClient telemetry = new TelemetryClient(); telemetry.TrackException(ex); } return(View(prjRes)); }
/// <summary> /// Adds a skill resource to the unit. /// </summary> /// <param name="resource">The skill resource</param> public void AddSkillResource(SkillResources resourceValue, SkillResource resource) { skillResources.Add(resourceValue, resource); }
//What will happen when there is not enough resources to cast a spell private void MethodIfEnoughForCast(Skill s, SkillResource type) { s.Use(); sm.UseResource(type, s.Cost, false); }
//What will happen when there is enough resources to keep holding the spell out private void MethodIfEnoughForHold(Skill s, SkillResource type) { s.CanUse = true; sm.UseResource(type, s.Cost, false); }
//Adds upgrade to particular skill with holdable or not at the end private Skill AddToAllSkillsList(string name, string desc, float effectAmnt, float c, float cd, Skills enumSkill, SkillType _type, SkillResource st, int req, StatsManager sm, bool tf) { Skill skill = new Skill(name, desc, effectAmnt, c, cd, enumSkill, _type, st, req, sm, tf); allSkills.Add(skill); return(skill); }
public ActionResult Create(int projectID) { IDAL dal = (new DALFactory()).GetInstance(); ProjectResources prjRes = new ProjectResources(); prjRes.projectId = projectID; List <SkillResource> lstSkillResource = new List <SkillResource>(); try { List <ProjectSkillResource> projectSkillResources = dal.GetAllProjectSkillResourcesByProjectID(projectID); //Get the resources and their skills assigned to the selcted Project. Hashtable objHashTable = new Hashtable(); if (projectSkillResources != null && projectSkillResources.Count > 0) { foreach (var item in projectSkillResources) { if (!objHashTable.ContainsKey(item.SkillId)) { objHashTable.Add(item.SkillId, item.SkillId); SkillResource objSkillResource = new SkillResource(); objSkillResource.skillId = item.SkillId; objSkillResource.skill = item.Skill; lstSkillResource.Add(objSkillResource); } } prjRes.skillResources = lstSkillResource; foreach (SkillResource skr in prjRes.skillResources) { foreach (var item in projectSkillResources) { if (skr.skillId == item.SkillId) { switch (item.CompetencyLevel.ToUpper()) { case "NOVICE": skr.beginnerCount = Convert.ToInt32(item.AvailableResourceCount == String.Empty ? "0" : item.AvailableResourceCount); break; case "ADVANCED BEGINNER": skr.advancedBeginnerCount = Convert.ToInt32(item.AvailableResourceCount == String.Empty ? "0" : item.AvailableResourceCount); break; case "COMPETENT": skr.competentCount = Convert.ToInt32(item.AvailableResourceCount == String.Empty ? "0" : item.AvailableResourceCount); break; case "PROFICIENT": skr.proficientCount = Convert.ToInt32(item.AvailableResourceCount == String.Empty ? "0" : item.AvailableResourceCount); break; case "EXPERT": skr.expertCount = Convert.ToInt32(item.AvailableResourceCount == String.Empty ? "0" : item.AvailableResourceCount); break; default: break; } } } } } } catch (Exception ex) { UserManager user = (UserManager)Session["CurrentUser"]; LogHelper.AddLog(new LogEntity(AppConstant.PartitionError, user.EmailID.ToString(), AppConstant.ApplicationName, "ProjectAvailableResource, Create", ex.Message, ex.StackTrace)); } return(View(prjRes)); }