public override void vygenerujSuradnice(Had had, List <Bod> plocha, Bod bodInehoPrvku, Bod bodInehoPrvkuTwo) { Aktivny = true; base.vygenerujSuradnice(had, plocha, bodInehoPrvku, bodInehoPrvkuTwo); bod.Color = farba; }
public void SetLeader(Bod bod) { if (!IsInParty(bod)) { m_leader = bod; } }
public Bod CreateNewFreelancer(string name, PersonalityType pt = PersonalityType.NONE) { Bod bod = CreateNewBod(name, pt, BodClass.FREELANCER); bod.SetFightingSkill(1); return(bod); }
public Party GetTestPlayerParty1() { Debug.Log("GetTestPlayerParty1"); // Leader Bod lord = BodManager.instance.CreateNewLordBod("Manfred", "Greenleaf", BodManager.instance.GetRandomPersonalityType(), true); // Player Party Party p = new Party(lord); // Body Guard Retainer Bod guard1 = BodManager.instance.CreateNewGuard("Derrik", "Alcroft"); p.AddRetainer(guard1); // 2 Fighting units Bod fl1 = BodManager.instance.CreateNewFreelancer("Jonas"); p.AddMember(fl1); Bod fl2 = BodManager.instance.CreateNewFreelancer("Cal"); p.AddMember(fl2); // 1 Non combatant Bod nc = BodManager.instance.CreateNewBod("Wendell"); p.AddMember(nc); return(p); }
public void AddRetainer(Bod bod) { if (!IsInParty(bod)) { m_retainers.Add(bod); } }
public void ResetBod(Bod bod) { bod.dead = false; bod.hp = GetBodMaxHP(bod); bod.ap = bod.endCore; bod.stress = 0; }
public void GenerateCharacterSkills(Bod bod) { LearnSkill(bod, SkillManager.instance.GetSkill("basic_strike")); LearnSkill(bod, SkillManager.instance.GetSkill("psy_bolt")); LearnSkill(bod, SkillManager.instance.GetSkill("raise_str")); LearnSkill(bod, SkillManager.instance.GetSkill("scan")); }
public void GenerateCharacterMindStats(Bod bod) { bod.burst = UnityEngine.Random.Range(0, 4); bod.rise = UnityEngine.Random.Range(0, 4); bod.trance = UnityEngine.Random.Range(0, 4); bod.mindMod = 0; }
string ResolveSpeedComparison(Bod b1, Bod b2, out Bod first, out Bod second, int spBonus1 = 0, int spBonus2 = 0) { int sp1 = RVCalc.RollD20(b1.agility + b1.fighting + spBonus1); int sp2 = RVCalc.RollD20(b2.agility + b2.fighting + spBonus2); string finalText = b1.name + "'s speed: " + sp1 + " vs. " + b2.name + "'s speed: " + sp2; if (sp1 > sp2) { first = b1; second = b2; } else if (sp2 > sp1) { first = b2; second = b1; } else // sp1 == sp2 { if (RVCalc.GetVal(1, 2) == 1) { finalText += "\nTie break: " + b1.name; first = b1; second = b2; } else { finalText += "\nTie break: " + b2.name; first = b2; second = b1; } } return(finalText); }
public void AddMember(Bod bod) { if (!IsInParty(bod)) { m_members.Add(bod); } }
public Bod CreateNewGuard(string name, string houseName, PersonalityType pt = PersonalityType.NONE) { Bod bod = CreateNewBod(name, houseName, pt, BodClass.GUARD); bod.SetStrength(2); bod.SetFightingSkill(2); return(bod); }
string ResolveAttack(Bod atk, Bod def, int atkPow) { string finalText = atk.name + " attacks " + def.name + " for " + atkPow + " dmg."; def.SetInjury(def.injury + atkPow); return(finalText); }
public void GenerateCharacterBodyStats(Bod bod) { bod.str = bod.strCore = UnityEngine.Random.Range(1, 6); bod.end = bod.endCore = UnityEngine.Random.Range(1, 6); bod.fortMod = 0; bod.dex = bod.dexCore = UnityEngine.Random.Range(1, 6); bod.spd = bod.spdCore = UnityEngine.Random.Range(1, 6); bod.agilMod = 0; }
public void RegreseMove(int selRobot, Vector2D moveTo, Core.Robot[] a, Core.Robot[] b) { Bod robo; Bod prekazka; Bod prekazka2; Bod cil; List <RobotDistance> lis = new List <RobotDistance>(); robo = new Bod(a[selRobot].Position.X, a[selRobot].Position.Y); cil = new Bod(moveTo.X, moveTo.Y); //hledani prekazek v ceste robota for (int i = 0; i < 5; i++) { prekazka = new Bod(b[i].Position.X, b[i].Position.Y); prekazka2 = new Bod(a[i].Position.X, a[i].Position.Y); try { if (IsObstacle(robo, prekazka, cil)) { lis.Add(new RobotDistance(new Bod(prekazka.x, prekazka.y), distanceTwoPoints(robo, prekazka))); } if (IsObstacle(robo, prekazka2, cil) && i != selRobot) { lis.Add(new RobotDistance(new Bod(prekazka2.x, prekazka2.y), distanceTwoPoints(robo, prekazka2))); } } catch { }; } int offset = 10; //objeti prekazky smerem k cili kterym je MoveTo if (lis.Count > 0) { try { var sort = from s in lis orderby s.vzdalenost select s; PolynomialRegresion regrese = new PolynomialRegresion(robo, new Bod(sort.ElementAt(0).bod.x, sort.ElementAt(0).bod.y), cil); List <Bod> body = regrese.polynom(true); if (cil.x > robo.x) { a[selRobot].PositionMove = new Vector2D(body[Convert.ToInt32(robo.x + offset) + 110].x, body[Convert.ToInt32(robo.x + offset) + 110].y); } else { a[selRobot].PositionMove = new Vector2D(body[Convert.ToInt32(robo.x - offset) + 110].x, body[Convert.ToInt32(robo.x - offset) + 110].y); } lis.RemoveAll(item => item.vzdalenost > 0); //Debug.Log(mirror + " - " + selRobot + " PREKAZKA pri MoveTo"); } catch { } } }
public async Task Bod_Should_Return_TypeOf_Bod() { await Task.Run(() => { Bod bod = new Bod(); Assert.NotNull(bod); Assert.IsType <Bod>(bod); }); }
public bool AddMember(Bod bod) { if (units.Count < maxUnits) { units.Add(bod); return(true); } return(false); }
public void sprava(Had had, VykreslovaciePole pole, Bod bodInehoPrvku, Bod bodInehoPrvkuTwo, bool aktivnyNasobic) { if (!aktivnyNasobic) { spravaNeaktNasobic(had, pole, bodInehoPrvku, bodInehoPrvkuTwo); } else { spravaAktNasobic(had, pole, bodInehoPrvku, bodInehoPrvkuTwo); } }
public BodToken GetToken(Bod bod) { foreach (BodToken token in tokens) { if (token.bodRef == bod) { return(token); } } return(null); }
private void generovanie(Had had, VykreslovaciePole pole, Bod bodInehoPrvku, Bod bodInehoPrvkuTwo) { if (Perioda == 0) { poslednyBod = nasobic.getBod; nasobic.vygenerujSuradnice(had, pole.Body, bodInehoPrvku, bodInehoPrvkuTwo); vygenerujDlzkuDostupnosti(); vygenerujPeriodu(); } Perioda--; }
public virtual void vygenerujSuradnice(Had had, List <Bod> plocha, Bod bodInehoPrvkuOne, Bod bodInehoPrvkuTwo) { vybielStaryBod(plocha); List <Bod> pomocneBody = plocha.ToList(); pomocneBody.RemoveAll(plo => had.BodyHada.ToList().Exists(h => h.X == plo.X && h.Y == plo.Y)); pomocneBody.Remove(bodInehoPrvkuOne); pomocneBody.Remove(bodInehoPrvkuTwo); bod = pomocneBody.Skip(random.Next(pomocneBody.Count)).Take(1).ToList().First(); }
public void regrese(Core.Robot[] a, Core.Robot[] b) { Bod robo; Bod prekazka; Bod prekazka2; Bod cil; List <RobotDistance> lis = new List <RobotDistance>(); for (int j = 0; j < 5; j++) { robo = new Bod(a[j].Position.X, a[j].Position.Y); cil = new Bod(a[j].PositionMove.X, a[j].PositionMove.Y); //cil = new Bod(ball.Position.X,ball.Position.Y); for (int i = 0; i < 5; i++) { prekazka = new Bod(b[i].Position.X, b[i].Position.Y); prekazka2 = new Bod(a[i].Position.X, a[i].Position.Y); try { if (IsObstacle(robo, prekazka, cil)) { lis.Add(new RobotDistance(new Bod(prekazka.x, prekazka.y), distanceTwoPoints(robo, prekazka))); } if (IsObstacle(robo, prekazka2, cil) && i != j) { lis.Add(new RobotDistance(new Bod(prekazka2.x, prekazka2.y), distanceTwoPoints(robo, prekazka2))); } } catch { }; } if (lis.Count > 0) { try { var sort = from s in lis orderby s.vzdalenost select s; PolynomialRegresion regrese = new PolynomialRegresion(robo, new Bod(sort.ElementAt(0).bod.x, sort.ElementAt(0).bod.y), cil); List <Bod> body = regrese.polynom(true); if (cil.x > robo.x) { a[j].PositionMove = new Vector2D(body[Convert.ToInt32(robo.x + 1) + 110].x, body[Convert.ToInt32(robo.x + 1) + 110].y); } else { a[j].PositionMove = new Vector2D(body[Convert.ToInt32(robo.x - 1) + 110].x, body[Convert.ToInt32(robo.x - 1) + 110].y); } lis.RemoveAll(item => item.vzdalenost > 0); } catch { } } } }
public Bod CreateNewLordBod(string name, string houseName, PersonalityType pt = PersonalityType.NONE, bool isCombatant = false) { Bod bod = CreateNewBod(name, houseName, pt, BodClass.LORD); bod.SetStrength(2); bod.SetAgility(2); bod.SetMind(2); if (isCombatant) { bod.SetFightingSkill(1); } return(bod); }
public void TestGpbod() { string input = "$GPBOD,097.0,T,103.2,M,POINTB,POINTA*4A"; var msg = NmeaMessage.Parse(input); Assert.IsInstanceOfType(msg, typeof(Bod)); Bod bod = (Bod)msg; Assert.AreEqual(97d, bod.TrueBearing, "TrueBearing"); Assert.AreEqual(103.2, bod.MagneticBearing, "MagneticBearing"); Assert.AreEqual("POINTB", bod.DestinationId, "DestinationID"); Assert.AreEqual("POINTA", bod.OriginId, "OriginID"); }
public void TakeDamage(Bod bod, int dmg) { BattleManager.instance.AddActionDisplayText(bod.name + " takes " + dmg + " damage!"); bod.hp -= dmg; if (bod.hp <= 0) { BattleManager.instance.BodDefeated(bod); bod.hp = 0; bod.dead = true; } }
public void TestGpbod_Empty() { string input = "$GPBOD,,T,,M,,*47"; var msg = NmeaMessage.Parse(input); Assert.IsInstanceOfType(msg, typeof(Bod)); Bod bod = (Bod)msg; Assert.AreEqual(double.NaN, bod.TrueBearing, "TrueBearing"); Assert.AreEqual(double.NaN, bod.MagneticBearing, "MagneticBearing"); Assert.IsNull(bod.OriginId, "OriginID"); Assert.IsNull(bod.DestinationId, "DestinationID"); }
public void TestGpbod_GoToMode() { string input = "$GPBOD,099.3,T,105.6,M,POINTB,*48"; var msg = NmeaMessage.Parse(input); Assert.IsInstanceOfType(msg, typeof(Bod)); Bod bod = (Bod)msg; Assert.AreEqual(99.3, bod.TrueBearing, "TrueBearing"); Assert.AreEqual(105.6, bod.MagneticBearing, "MagneticBearing"); Assert.AreEqual("POINTB", bod.DestinationId, "DestinationID"); Assert.IsNull(bod.OriginId, "OriginID"); }
private void kontrolaDvojnasobnosti(Had had) { if (DalsiPohybJeDvojnasobny) { DalsiPohybJeDvojnasobny = false; GlobalnePremenne.skore += ZvysenieSkore; } else { poslednyBodHada = new Bod(had.getChvost().X, had.getChvost().Y, Colors.Black); had.vymazChvost(); } }
public void SetBod(Bod b) { Debug.Log("Setting Action Menu for: " + b.name); bod = b; Debug.Log(BodManager.instance.GetStats(bod)); bodNameText.text = bod.name; mainButtonSet.SetActive(true); actionTypeButtonSet.SetActive(false); actionButtonSet.SetActive(false); }
public Bod CreateNewBod(string name, PersonalityType pt = PersonalityType.NONE, BodClass bc = BodClass.NONE) { if (pt == PersonalityType.NONE) { pt = GetRandomPersonalityType(); } Bod bod = new Bod(name, "", pt, bc); bod.SetStrength(1); bod.SetAgility(1); bod.SetMind(1); return(bod); }
public void BodDefeated(Bod bod) { AddActionDisplayText(bod.name + " died!"); foreach (BodToken token in tokens) { if (token.bodRef == bod) { tokens.Remove(token); turnOrder.Remove(token); battleBoard.tokenPositions[token.posX, token.posY] = null; Destroy(token.gameObject); break; } } }
private bool jeMozneVodorovneNapojeni(Bod zkoumany, Bod kontrolovany) { if (Math.Abs(zkoumany.x - kontrolovany.x) >= zkoumany.hodnotaBodu) { return false; } if (Math.Abs(zkoumany.y - kontrolovany.y) >= kontrolovany.hodnotaBodu) { return false; } return true; }
private bool kontrolaOkraju(Bod bod) { if (matice.GetLength(0) < bod.x && matice.GetLength(1) < bod.y && bod.y >= 0 && bod.x >= 0) { return true; } return false; }
private bool odpovidaDelkaCeste(Bod bod, bool[,] cesta) { int delkaCesty = 0; if ((bod.x - 1 < 0 || !cesta[bod.x - 1, bod.y]) && (bod.x + 1 == cesta.GetLength(0) || !cesta[bod.x + 1, bod.y])) { int y = bod.y; while (y - 1 >= 0 && cesta[bod.x, y - 1]) { y--; } while (y < cesta.GetLength(1) && cesta[bod.x, y]) { y++; delkaCesty++; } } else if ((bod.y - 1 < 0 || !cesta[bod.x, bod.y - 1]) && (bod.y + 1 == cesta.GetLength(1) || !cesta[bod.x, bod.y + 1])) { int x = bod.x; while (x - 1 >= 0 && cesta[x - 1, bod.y]) { x--; } while (x < cesta.GetLength(0) && cesta[x, bod.y]) { x++; delkaCesty++; } } else { int y = bod.y; while (y - 1 >= 0 && cesta[bod.x, y - 1]) { y--; } while (y < cesta.GetLength(1) && cesta[bod.x, y]) { y++; delkaCesty++; } int x = bod.x; while (x - 1 >= 0 && cesta[x - 1, bod.y]) { x--; } while (x < cesta.GetLength(0) && cesta[x, bod.y]) { x++; delkaCesty++; } return bod.hodnotaBodu * 2 == delkaCesty; } return bod.hodnotaBodu == delkaCesty; }
private List<bool[, ]> provedKontroluSouvislosti(List<bool[,]> listCest) { List<bool[,]> listSouvislych = new List<bool[,]>(); foreach (var cesta in listCest) { int delkaCesty = 0; bool prvni = true; Bod prvniBod = new Bod(0, 0, 0); for (int i = 0; i < cesta.GetLength(0); i++) { for (int j = 0; j < cesta.GetLength(1); j++) { if (cesta[i, j]) { delkaCesty++; if (prvni) { prvniBod = new Bod(i, j, 0); prvni = false; } } } } int pocetProjitych = vratDelkuSouvisleCesty(cesta, prvniBod); if (pocetProjitych == delkaCesty) { listSouvislych.Add(cesta); } } return listSouvislych; }
private int vratDelkuSouvisleCesty(bool[,] cesta, Bod prvniBod) { Stack<Tuple<int, int>> zasobnik = new Stack<Tuple<int, int>>(); zasobnik.Push(new Tuple<int, int>(prvniBod.x, prvniBod.y)); List<Tuple<int, int>> projite = new List<Tuple<int, int>>(); while (zasobnik.Count > 0) { var bod = zasobnik.Pop(); projite.Add(bod); if (bod.Item1 - 1 >= 0 && cesta[bod.Item1 - 1, bod.Item2]) { var pom = new Tuple<int, int>(bod.Item1 - 1, bod.Item2); if (!projite.Contains(pom) && !zasobnik.Contains(pom)) { zasobnik.Push(pom); } } if (bod.Item1 + 1 < cesta.GetLength(0) && cesta[bod.Item1 + 1, bod.Item2]) { var pom = new Tuple<int, int>(bod.Item1 + 1, bod.Item2); if (!projite.Contains(pom) && !zasobnik.Contains(pom)) { zasobnik.Push(pom); } } if (bod.Item2 - 1 >= 0 && cesta[bod.Item1, bod.Item2 - 1]) { var pom = new Tuple<int, int>(bod.Item1, bod.Item2 - 1); if (!projite.Contains(pom) && !zasobnik.Contains(pom)) { zasobnik.Push(pom); } } if (bod.Item2 + 1 < cesta.GetLength(1) && cesta[bod.Item1, bod.Item2 + 1]) { var pom = new Tuple<int, int>(bod.Item1, bod.Item2 + 1); if (!projite.Contains(pom) && !zasobnik.Contains(pom)) { zasobnik.Push(pom); } } } return projite.Count; }
private void generujSvisleCesty(Bod bod) { for (int j = -(bod.hodnotaBodu - 1); j <= 0; j++) { if ((bod.y + j) >= 0 && (j + bod.y + bod.hodnotaBodu) <= matice.GetLength(1)) { bool[,] cesta = (bool[,])prazdnaCesta.Clone(); for (int k = 0; k < bod.hodnotaBodu; k++) { cesta[bod.x, j + k + bod.y] = true; } bod.mozneCesty.Add(cesta); } } }
public void ObrisiBod(Bod bod) { try { LavDataClassesDataContext _baza = new LavDataClassesDataContext(konekcioniString); //ovo mora zato sto se ne moze dodati u ovaj DataContext zato sto pripada nekom drugom DB.Bod _bod = new DB.Bod { BodID = bod.BodID, Sifra = bod.Sifra, Naziv = bod.Naziv, Vrednost = bod.Vrednost }; _baza.Bods.Attach(_bod); _baza.Bods.DeleteOnSubmit(_bod); _baza.SubmitChanges(); } catch (Exception ex) { throw ex; } }
public void UnesiBod(Bod bod) { try { LavDataClassesDataContext _baza = new LavDataClassesDataContext(konekcioniString); _baza.ResetujBrojac("Bod", "BodID"); if (bod.Sifra == null) { bod.Sifra = _baza.DajSledeciIdentity("Bod").ToString(); } _baza.Bods.InsertOnSubmit(bod); _baza.SubmitChanges(); } catch (Exception ex) { throw ex; } }
public void IzmeniBod(Bod bod, Bod bodOrginal) { try { LavDataClassesDataContext _baza = new LavDataClassesDataContext(konekcioniString); _baza.Bods.Attach(bod, bodOrginal); _baza.SubmitChanges(); } catch (Exception ex) { throw ex; } }