public bool IsAdjacentTo(mob other) { return( (Mathf.Abs(posx - other.posx) == 1 && posy == other.posy) || (Mathf.Abs(posy - other.posy) == 1 && posx == other.posx) ); }
public int bombx, bomby; //sloppy- should use mob instead public item_instance(Etilesprite _tile, bool _ismob = false, mob m = null, int _bombcount = 0) { tile = _tile; ismob = _ismob; mob = m; bombcount = _bombcount; }
public List <Cell> emptyspaces; //free squares public void killoffamob(mob f, bool purgecityunitlist = false) { //remove upkeep cost if (f.citythatownsit != null) { f.citythatownsit.armycostperturn_food -= f.archetype.upkeepfood; f.citythatownsit.armycostperturn_gold -= f.archetype.upkeepgold; } else { //must be hero mob: player.herogoldupkeep -= f.archetype.upkeepgold; } f.tile = Etilesprite.EMPTY; //this will make the processturn function garbage collect the mob from moblist passable[f.posx, f.posy] = true; itemgrid[f.posx, f.posy] = null; if (f.citythatownsit != null) { if (purgecityunitlist) { f.citythatownsit.unitlist.RemoveAll(x => x.tile == Etilesprite.EMPTY); } } }
void movemob(mob m, int tentx, int tenty) { if (m.isplayer) { m.posx = tentx; m.posy = tenty; moveplayer(); } else { if (m.posx != tentx || m.posy != tenty) { //debug move onto bomb? if (map.itemgrid[tentx, tenty] != null) { item_instance i = map.itemgrid[tentx, tenty]; log.Printline("WARNING MOB MOVING ONTO " + Tilestuff.tilestring[(int)i.tile + 2] ); } //end debug map.itemgrid[tentx, tenty] = map.itemgrid[m.posx, m.posy]; map.itemgrid[m.posx, m.posy] = null; m.posx = tentx; m.posy = tenty; } } }
void MobAttacksMob(mob attacker, mob target) { //terrain mods for pango on pango combat only, not cities bool terrainATKbonus = (map.hill[attacker.posx, attacker.posy] && !map.hill[target.posx, target.posy]); bool terrainDEFbonus = (map.tree[target.posx, target.posy] && !map.tree[attacker.posx, target.posy]); int attackroll = lil.randi(attacker.archetype.attacklow, attacker.archetype.attackhigh); int defroll = (target.usedDEFthisturn) ? 0 : (target.archetype.defence + target.defencebonus); int t_atk = (attackroll + attacker.attackbonus) / 4; int t_def = defroll / 4; if (t_atk == 0) { t_atk = 1; } if (t_def == 0) { t_def = 1; } if (!terrainATKbonus) { t_atk = 0; } if (!terrainDEFbonus) { t_def = 0; } log.Printline(attacker.archetype.name + " ATK " + attacker.archetype.attacklow + "-" + attacker.archetype.attackhigh + " +" + attacker.attackbonus + " rolls " + attackroll + " =" + (attackroll + attacker.attackbonus) + " + " + t_atk + " TRN", Color.blue); if (target.usedDEFthisturn) { log.Printline(target.archetype.name + " DEF 0 (already used this turn)", Color.blue); } else { log.Printline(target.archetype.name + " DEF " + target.archetype.defence + " +" + target.defencebonus + " + " + t_def + " TRN", Color.blue); } int damage = (attackroll + attacker.attackbonus + t_atk) - (defroll + t_def); if (damage < 1) { damage = 0; } FloatingDamage(target, attacker, -damage, attacker.archetype.weaponname); target.usedDEFthisturn = true; }
mob CreateMob(Emobtype t, int tentx, int tenty) { mob m = new mob(t); m.posx = tentx; m.posy = tenty; map.itemgrid[tentx, tenty] = new item_instance(m.tile, true, m); map.passable[tentx, tenty] = false; map.newmoblist.Add(m); return(m); }
public bool spiralscan(mob m) { int scanx = m.posx; int scany = m.posy; int targetx = scanx + 10; int direction = 0; //right (up left down) int which = 0; //0 is first time, 1 is 2nd int length = 1; while (scanx < targetx) { for (int sides = 0; sides < 2; sides++) { for (int rep = 0; rep < length; rep++) { scanx += spiraldx[direction]; scany += spiraldy[direction]; //checksquare and if found fill and return if (scanx >= 0 && scany >= 0 && scanx < width && scany < height) { if (m.hostile_toenemies_currently && itemgrid[scanx, scany] != null && itemgrid[scanx, scany].mob.hostile_toplayer_currently || m.hostile_toplayer_currently && itemgrid[scanx, scany] != null && itemgrid[scanx, scany].mob.hostile_toenemies_currently) { m.AIformob.targetsquare = new Cell(scanx, scany); return(true); } if (m.hostile_toplayer_currently && player.posx == scanx && player.posy == scany) { m.AIformob.targetsquare = new Cell(scanx, scany); return(true); } if (m.hostile_toplayer_currently && buildings[scanx, scany] == Etilesprite.BUILDINGS_CITY) { m.AIformob.targetsquare = new Cell(scanx, scany); return(true); } if (m.hostile_toenemies_currently && buildings[scanx, scany] == Etilesprite.BUILDINGS_BARBARIAN_CAMP || buildings[scanx, scany] == Etilesprite.BUILDINGS_BARBARIAN_CITADEL) { m.AIformob.targetsquare = new Cell(scanx, scany); return(true); } } } direction++; if (direction == 4) { direction = 0; } } length++; } return(false); }
public bool updateMob(mob updMob, int id) { getMobByID(id).updateMob(updMob); checkConstraints("mob"); if (bDataConstraintErrExists) { return(false); } return(true); }
// Update is called once per frame void Update() { if (player.opponent != null) { target = player.opponent.GetComponent <mob>(); healthPercentage = (float)target.health / (float)target.maxHealth; } else { target = null; healthPercentage = 0; } }
public mob getMobByID(int id) { mob rtnMob = new mob(); foreach (mob m in mobs) { if (m.mID == id) { rtnMob = m; } } return(rtnMob); }
void CreateMob(Emobtype t, int tentx, int tenty) {//copied from Game.CreateMob mob m = new mob(t); m.attackbonus = attackbonus; m.defencebonus = defencebonus; m.posx = tentx; m.posy = tenty; map.itemgrid[tentx, tenty] = new item_instance(m.tile, true, m); map.passable[tentx, tenty] = false; map.newmoblist.Add(m); unitlist.Add(m); armycostperturn_food += m.archetype.upkeepfood; armycostperturn_gold += m.archetype.upkeepgold; m.citythatownsit = this; // return m; }
void init(int which) { mob = new mob((Emobtype)which); mob.isplayer = true; posx = 0; posy = 0; lantern = true; stealthed = false; //hp = mob.hp;// mana = 0; //stasis = 0; score = 0; //charlevel = 0; dunlevel = 0; turns = 0; }
public bool passablecheck(int x, int y, mob m) { //you can freely move across your own city and addons but not across enemy ones. also no moving over mobs if (itemgrid[x, y] != null) { return(false); } if (m == player.mob) { return(true); } else { return(passable[x, y]); } // return (passable[x, y] || displaychar[x, y] == Etilesprite.MAP_WATER && m.archetype.heavy); }
public void removeMob(int id) { mob removeMob = null; foreach (mob m in mobs) { if (m.mID == id) { removeMob = m; } } if (removeMob != null) { mobs.Remove(removeMob); } }
void MobAttacksCity(mob attacker, Ccity target) { int attackroll = lil.randi(attacker.archetype.attacklow, attacker.archetype.attackhigh); int defroll = (target.usedDEFthisturn) ? 0 : (target.defence); log.Printline(attacker.archetype.name + " ATK " + attacker.archetype.attacklow + "-" + attacker.archetype.attackhigh + " +" + attacker.attackbonus + " rolls " + attackroll + " =" + (attackroll + attacker.attackbonus), Color.blue); if (target.usedDEFthisturn) { log.Printline(target.name + " DEF 0 (already used this turn)", Color.blue); } else { log.Printline(target.name + " DEF " + target.defence); } int damage = attackroll + attacker.attackbonus - defroll; if (damage < 1) { damage = 0; } FloatingDamagetoCity(target, attacker, -damage, attacker.archetype.weaponname); target.usedDEFthisturn = true; //i think it's ok to actually kill the city at this point. if (target.hp <= 0) { log.Printline("The " + ((!target.isfrenzleecity) ? "barbarian ":"") + "city of " + target.name + " was destroyed", Color.red); log.Printline("by " + attacker.archetype.name, Color.red); if (!target.isfrenzleecity) { player.score += 100; } bool won = (map.buildings[target.posx, target.posy] == Etilesprite.BUILDINGS_BARBARIAN_CITADEL); map.CityKiller(target.posx, target.posy); if (won) { log.Printline("Peace has been brought to the land.", Color.yellow); NextLevel(); } } }
void FloatingDamagetoCity(Ccity victim, mob attacker, int amount, string explanation = "", bool flashsupress = false) { Color c; if (amount == 0) { c = Color.grey; } else { c = (amount < 0) ? Color.red : Color.green; } FloatingTextItems.Add(new FloatingTextItem(explanation + " " + amount + " hp", victim.posx, victim.posy, c)); if (attacker == player.mob) { log.Printline(attacker.archetype.name + " deals " + (-amount) + " to " + victim.name + " [" + explanation + "]", Color.green); } else { log.Printline(victim.name, c); if (amount <= 0) { log.Print(" takes ", c); } else { log.Print(" gains ", c); } log.Print(amount + " from " + attacker.archetype.name, c); if (explanation.Length > 0) { log.Print("[" + explanation + "]", c); } } //actually do the damage victim.hp += amount; c.a = 0.5f; map.gridflashcolour[victim.posx, victim.posy] = c; map.gridflashtime[victim.posx, victim.posy] = Time.time + 0.5f; }
protected override void Initialize() { this.graphics.IsFullScreen = false; this.graphics.ApplyChanges(); this.Window.Title = "Jeu"; // mainFrame = new Rectangle(0, 0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height); for (int i = 0; i <= 1; i++) { Mob[i] = new mob(); } for (int i = 0; i < maps.Length; i++) { maps[i] = new Map(); } Mob[0].moveMob(new Vector2(500, 250)); Mob[1].moveMob(new Vector2(600, 250)); perso.movePerso(new Vector2(150, 180)); base.Initialize(); }
public void Start() { StartCoroutine(Battle()); mob = GetComponent <mob> (); }
public bool createMob(mob newMob) { String mobStr = newMob.mID.ToString(); mobStr += ",'" + newMob.mSprName; mobStr += "','" + newMob.mJpnName; mobStr += "','" + newMob.mEngName; mobStr += "'," + newMob.mLvl.ToString(); mobStr += "," + newMob.mHP.ToString(); mobStr += "," + newMob.mSP.ToString(); mobStr += "," + newMob.mBaseXP.ToString(); mobStr += "," + newMob.mJobXP.ToString(); mobStr += "," + newMob.mAtkRng.ToString(); mobStr += "," + newMob.mMinAtk.ToString(); mobStr += "," + newMob.mMaxAtk.ToString(); mobStr += "," + newMob.mDef.ToString(); mobStr += "," + newMob.mMDef.ToString(); mobStr += "," + newMob.mStr.ToString(); mobStr += "," + newMob.mAgi.ToString(); mobStr += "," + newMob.mVit.ToString(); mobStr += "," + newMob.mInt.ToString(); mobStr += "," + newMob.mDex.ToString(); mobStr += "," + newMob.mLuk.ToString(); mobStr += "," + newMob.mSkRng.ToString(); mobStr += "," + newMob.mVwRng.ToString(); mobStr += "," + newMob.mScale.ToString(); mobStr += "," + newMob.mRace.ToString(); mobStr += "," + newMob.mEle.ToString(); mobStr += "," + newMob.mBevMask.ToString(); mobStr += "," + newMob.mWlkSpd.ToString(); mobStr += "," + newMob.mAtkDly.ToString(); mobStr += "," + newMob.mAtkMot.ToString(); mobStr += "," + newMob.mDmgMot.ToString(); mobStr += "," + newMob.mMXP.ToString(); mobStr += "," + newMob.mMDrop1ID.ToString(); mobStr += "," + newMob.mMDrop1Perc.ToString(); mobStr += "," + newMob.mMDrop2ID.ToString(); mobStr += "," + newMob.mMDrop2Perc.ToString(); mobStr += "," + newMob.mMDrop3ID.ToString(); mobStr += "," + newMob.mMDrop3Perc.ToString(); mobStr += "," + newMob.mDrop1ID.ToString(); mobStr += "," + newMob.mDrop1Perc.ToString(); mobStr += "," + newMob.mDrop2ID.ToString(); mobStr += "," + newMob.mDrop2Perc.ToString(); mobStr += "," + newMob.mDrop3ID.ToString(); mobStr += "," + newMob.mDrop3Perc.ToString(); mobStr += "," + newMob.mDrop4ID.ToString(); mobStr += "," + newMob.mDrop4Perc.ToString(); mobStr += "," + newMob.mDrop5ID.ToString(); mobStr += "," + newMob.mDrop5Perc.ToString(); mobStr += "," + newMob.mDrop6ID.ToString(); mobStr += "," + newMob.mDrop6Perc.ToString(); mobStr += "," + newMob.mDrop7ID.ToString(); mobStr += "," + newMob.mDrop7Perc.ToString(); mobStr += "," + newMob.mDrop8ID.ToString(); mobStr += "," + newMob.mDrop8Perc.ToString(); mobStr += "," + newMob.mDrop9ID.ToString(); mobStr += "," + newMob.mDrop9Perc.ToString(); mobStr += "," + newMob.mCardDropID.ToString(); mobStr += "," + newMob.mCardDropPerc.ToString(); mobs.Add(new mob(mobStr, true, newMob.mobLocale, dhLog)); if (mobs[mobs.LastIndexOf(mobs.Last())].bWarningsOccurred && !bShowErrorsInApp) { MessageBox.Show(null, "Warnings occurred while saving this mob. Please check the log file(s) for more information.", "Mob Creation Generated Warnings", MessageBoxButtons.OK); } if (mobs[mobs.LastIndexOf(mobs.Last())].bCritFailure) { return(false); } checkConstraints("mob"); if (bDataConstraintErrExists) { return(false); } appendSourceFile(newMob.mobLocale, mobStr); return(true); }
void FloatingDamage(mob victim, mob attacker, int amount, string explanation = "", bool flashsupress = false) { Color c; //deal with super buffs if (victim != attacker) { if (attacker.hasattackup) { amount -= 100; if (!victim.dead_currently) { log.Printline("Aided by cairn power " + attacker.archetype.name + " strikes true!", Color.magenta); } } if (victim.hasdefenseup) { if (amount < 0) { amount = 0; if (!victim.dead_currently) { log.Printline("The cairn power protects " + victim.archetype.name + "!", Color.magenta); } } } } if (amount == 0) { c = Color.grey; } else { c = (amount < 0) ? Color.red : Color.green; } if (amount > 0 && victim.hp + amount > victim.archetype.hp) { amount = victim.archetype.hp - victim.hp; } FloatingTextItems.Add(new FloatingTextItem(explanation + " " + amount + " hp", victim.posx, victim.posy, c)); // if (attacker.tile == Etilesprite.ENEMY_GIANTBAT && victim != attacker) FloatingDamage(attacker, attacker, -amount, "blood drain"); // if ((attacker.tile == Etilesprite.ENEMY_NECROMANCER||attacker.tile==Etilesprite.ENEMY_LICH) && victim != attacker) FloatingDamage(attacker, attacker, -amount, "drain life"); if (attacker == player.mob && victim != player.mob) { if (!victim.dead_currently) { log.Printline(attacker.archetype.name + " deals " + (-amount) + " to " + victim.archetype.name + " [" + explanation + "]", Color.green); } } else { if (!victim.dead_currently) { log.Printline(victim.archetype.name, c); if (amount <= 0) { log.Print(" takes ", c); } else { log.Print(" gains ", c); } if (victim == attacker) { log.Print(amount + " ", c); } else { log.Print(amount + " from " + attacker.archetype.name, c); } if (explanation.Length > 0) { log.Print("[" + explanation + "]", c); } } } //actually do the damage victim.hp += amount; c.a = 0.5f; //if (map.displaychar[victim.posx, victim.posy] != Etilesprite.MAP_WATER && amount != 0) // if (map.bloodgrid[victim.posx, victim.posy] == null) // { // if(victim.archetype.tile!=Etilesprite.ENEMY_ICE_GOLEM && victim.undead_currently==false) // map.bloodgrid[victim.posx, victim.posy] = lil.randi(0, 3) + ((amount < -3) ? 4 : 0); // } map.gridflashcolour[victim.posx, victim.posy] = c; map.gridflashtime[victim.posx, victim.posy] = Time.time + 0.5f; //if (attacker.tile == Etilesprite.ENEMY_MAGE && attacker!=victim) //{ // log.Printline(victim.archetype.name + " is slowed!"); // victim.speed = 0; //} }
private void getMob(object sender, EventArgs e) { selectedMob = dHandle.getMob(cboxMobList.SelectedIndex); }
private void OnSaveMobClicked(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; mob newMob; String indStr; if (bMobIsNew) { newMob = new mob(true, true); } else { newMob = new mob(); } newMob.mID = parseIVal(tboxMID.Text); newMob.mSprName = tboxMSprName.Text; newMob.mJpnName = tboxMJpnName.Text; newMob.mEngName = tboxMEngName.Text; newMob.mLvl = parseIVal(tboxMLvl.Text); newMob.mHP = parseIVal(tboxMHP.Text); newMob.mSP = parseIVal(tboxMSP.Text); newMob.mBaseXP = parseIVal(tboxMBaseXP.Text); newMob.mJobXP = parseIVal(tboxMJobXP.Text); newMob.mAtkRng = parseIVal(tboxMAtkRng.Text); newMob.mMinAtk = parseIVal(tboxMMinAtk.Text); newMob.mMaxAtk = parseIVal(tboxMMaxAtk.Text); newMob.mDef = parseIVal(tboxMDef.Text); newMob.mMDef = parseIVal(tboxMMDef.Text); newMob.mStr = parseIVal(tboxMStr.Text); newMob.mAgi = parseIVal(tboxMAgi.Text); newMob.mVit = parseIVal(tboxMVit.Text); newMob.mInt = parseIVal(tboxMInt.Text); newMob.mDex = parseIVal(tboxMDex.Text); newMob.mLuk = parseIVal(tboxMLuk.Text); newMob.mSkRng = parseIVal(tboxMSkRng.Text); newMob.mVwRng = parseIVal(tboxMVwRng.Text); if (cboxMScale.SelectedIndex != -1) { indStr = ((KeyValuePair <String, int>)cboxMScale.Items[cboxMScale.SelectedIndex]).Key; if (ConstData.mobSizes.ContainsKey(indStr)) { newMob.mScale = ConstData.mobSizes[indStr]; } } else { newMob.mScale = 0; } if (cboxMRace.SelectedIndex != -1) { indStr = ((KeyValuePair <String, int>)cboxMRace.Items[cboxMRace.SelectedIndex]).Key; if (ConstData.mobRaces.ContainsKey(indStr)) { newMob.mRace = ConstData.mobRaces[indStr]; } } else { newMob.mRace = 0; } newMob.mEle = parseIVal(tboxMEle.Text); newMob.mBevMask = mobBehviorVal; newMob.mWlkSpd = parseIVal(tboxMWlkSpd.Text); newMob.mAtkDly = parseIVal(tboxMAtkDly.Text); newMob.mAtkMot = parseIVal(tboxMAtkMot.Text); newMob.mDmgMot = parseIVal(tboxMDmgMot.Text); newMob.mMXP = parseIVal(tboxMMXP.Text); if (cboxMMDrop1ID.SelectedIndex != -1) { indStr = ((KeyValuePair <String, int>)cboxMMDrop1ID.Items[cboxMMDrop1ID.SelectedIndex]).Key; if (itemList.ContainsKey(indStr)) { newMob.mMDrop1ID = itemList[indStr]; } } else { newMob.mMDrop1ID = 0; } newMob.mMDrop1Perc = parseIVal(tboxMMDrop1Perc.Text); if (cboxMMDrop2ID.SelectedIndex != -1) { indStr = ((KeyValuePair <String, int>)cboxMMDrop2ID.Items[cboxMMDrop2ID.SelectedIndex]).Key; if (itemList.ContainsKey(indStr)) { newMob.mMDrop2ID = itemList[indStr]; } } else { newMob.mMDrop2ID = 0; } newMob.mMDrop2Perc = parseIVal(tboxMMDrop2Perc.Text); if (cboxMMDrop3ID.SelectedIndex != -1) { indStr = ((KeyValuePair <String, int>)cboxMMDrop3ID.Items[cboxMMDrop3ID.SelectedIndex]).Key; if (itemList.ContainsKey(indStr)) { newMob.mMDrop3ID = itemList[indStr]; } } else { newMob.mMDrop3ID = 0; } newMob.mMDrop3Perc = parseIVal(tboxMMDrop3Perc.Text); if (cboxMDrop1ID.SelectedIndex != -1) { indStr = ((KeyValuePair <String, int>)cboxMDrop1ID.Items[cboxMDrop1ID.SelectedIndex]).Key; if (itemList.ContainsKey(indStr)) { newMob.mDrop1ID = itemList[indStr]; } } else { newMob.mDrop1ID = 0; } newMob.mDrop1Perc = parseIVal(tboxMDrop1Perc.Text); if (cboxMDrop2ID.SelectedIndex != -1) { indStr = ((KeyValuePair <String, int>)cboxMDrop2ID.Items[cboxMDrop2ID.SelectedIndex]).Key; if (itemList.ContainsKey(indStr)) { newMob.mDrop2ID = itemList[indStr]; } } else { newMob.mDrop2ID = 0; } newMob.mDrop2Perc = parseIVal(tboxMDrop2Perc.Text); if (cboxMDrop3ID.SelectedIndex != -1) { indStr = ((KeyValuePair <String, int>)cboxMDrop3ID.Items[cboxMDrop3ID.SelectedIndex]).Key; if (itemList.ContainsKey(indStr)) { newMob.mDrop3ID = itemList[indStr]; } } else { newMob.mDrop3ID = 0; } newMob.mDrop3Perc = parseIVal(tboxMDrop3Perc.Text); if (cboxMDrop4ID.SelectedIndex != -1) { indStr = ((KeyValuePair <String, int>)cboxMDrop4ID.Items[cboxMDrop4ID.SelectedIndex]).Key; if (itemList.ContainsKey(indStr)) { newMob.mDrop4ID = itemList[indStr]; } } else { newMob.mDrop4ID = 0; } newMob.mDrop4Perc = parseIVal(tboxMDrop4Perc.Text); if (cboxMDrop5ID.SelectedIndex != -1) { indStr = ((KeyValuePair <String, int>)cboxMDrop5ID.Items[cboxMDrop5ID.SelectedIndex]).Key; if (itemList.ContainsKey(indStr)) { newMob.mDrop5ID = itemList[indStr]; } } else { newMob.mDrop5ID = 0; } newMob.mDrop5Perc = parseIVal(tboxMDrop5Perc.Text); if (cboxMDrop6ID.SelectedIndex != -1) { indStr = ((KeyValuePair <String, int>)cboxMDrop6ID.Items[cboxMDrop6ID.SelectedIndex]).Key; if (itemList.ContainsKey(indStr)) { newMob.mDrop6ID = itemList[indStr]; } } else { newMob.mDrop6ID = 0; } newMob.mDrop6Perc = parseIVal(tboxMDrop6Perc.Text); if (cboxMDrop7ID.SelectedIndex != -1) { indStr = ((KeyValuePair <String, int>)cboxMDrop7ID.Items[cboxMDrop7ID.SelectedIndex]).Key; if (itemList.ContainsKey(indStr)) { newMob.mDrop7ID = itemList[indStr]; } } else { newMob.mDrop7ID = 0; } newMob.mDrop7Perc = parseIVal(tboxMDrop7Perc.Text); if (cboxMDrop8ID.SelectedIndex != -1) { indStr = ((KeyValuePair <String, int>)cboxMDrop8ID.Items[cboxMDrop8ID.SelectedIndex]).Key; if (itemList.ContainsKey(indStr)) { newMob.mDrop8ID = itemList[indStr]; } } else { newMob.mDrop8ID = 0; } newMob.mDrop8Perc = parseIVal(tboxMDrop8Perc.Text); if (cboxMDrop9ID.SelectedIndex != -1) { indStr = ((KeyValuePair <String, int>)cboxMDrop9ID.Items[cboxMDrop9ID.SelectedIndex]).Key; if (itemList.ContainsKey(indStr)) { newMob.mDrop9ID = itemList[indStr]; } } else { newMob.mDrop9ID = 0; } newMob.mDrop9Perc = parseIVal(tboxMDrop9Perc.Text); if (cboxMCardDropID.SelectedIndex != -1) { indStr = ((KeyValuePair <String, int>)cboxMCardDropID.Items[cboxMCardDropID.SelectedIndex]).Key; if (itemList.ContainsKey(indStr)) { newMob.mCardDropID = itemList[indStr]; } } else { newMob.mCardDropID = 0; } newMob.mCardDropPerc = parseIVal(tboxMCardDropPerc.Text); if (cboxMobLocal.SelectedIndex != -1) { newMob.mobLocale = cboxMobLocal.GetItemText(cboxMobLocal.SelectedItem); } else { newMob.mobLocale = "custom_mob"; } if (!bWasDataInputError) { if (bMobIsNew) { if (dHandle.createMob(newMob)) { Cursor.Current = Cursors.Default; MessageBox.Show(this, "The mob was created successfully.", "Mob Creation Successful", MessageBoxButtons.OK); clearData(); } else { Cursor.Current = Cursors.Default; if (!bShowErrorsInApp) { MessageBox.Show(this, "There were errors creating your new mob. Please refer to the log file(s) for more information.", "Mob Creation Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); } dHandle.removeMob(newMob.mID); } } else { if (dHandle.updateMob(newMob, newMob.mID)) { Cursor.Current = Cursors.Default; MessageBox.Show(this, "The updates to this mob have been applied.", "Mob Updated Successfully", MessageBoxButtons.OK); clearData(); } else { Cursor.Current = Cursors.Default; if (!bShowErrorsInApp) { MessageBox.Show(this, "There were errors updating this mob. Please refer to the log file(s) for more information.", "Mob Update Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } else { Cursor.Current = Cursors.Default; MessageBox.Show(this, "One of more of the fields are missing data and could not be parsed. Please check for non-numerical characters or blank fields and try saving again.", "Data Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } bWasDataInputError = false; }
bool trytomove(mob m, int deltax, int deltay)//, int rotdir, bool coasting = false) { bool didsomething = false; if (deltax == 1) { m.reversesprite = false; } else if (deltax == -1) { m.reversesprite = true; } int tentx = m.posx + deltax; int tenty = m.posy + deltay; //if tentative spot is off map, return if (tentx < 0 || tentx >= map.width || tenty < 0 || tenty >= map.height) { return(false); } //if tentative spot is goodie hut, let's open it if (m == player.mob && map.buildings[tentx, tenty] == Etilesprite.BUILDINGS_GOODIE_HUT && map.itemgrid[tentx, tenty] == null) { if (!map.havewehadbroomyet && lil.randi(1, 100) <= 20) { log.Printline("o shit waddup, heer come dat broom!", Color.cyan); log.Printline("Bristleboi is on the payroll nao. 10g/turn.", Color.cyan); mob mmm = CreateMob(Emobtype.broom, tentx, tenty); player.herogoldupkeep += mmm.archetype.upkeepgold; } else { log.Printline("You find a bunch of gold", Color.yellow); player.gold += 200; } map.buildings[tentx, tenty] = Etilesprite.EMPTY; } //if tentative spot is enemy city, attack it if (map.buildings[tentx, tenty] == Etilesprite.BUILDINGS_CITY || map.buildings[tentx, tenty] == Etilesprite.BUILDINGS_BARBARIAN_CAMP || map.buildings[tentx, tenty] == Etilesprite.BUILDINGS_BARBARIAN_CITADEL) { Ccity cc = map.citythathasinfluence[tentx, tenty]; if (cc != null && (m.hostile_toenemies_currently && !cc.isfrenzleecity || m.hostile_toplayer_currently && cc.isfrenzleecity)) { MobAttacksCity(m, cc); didsomething = true; goto okhadfun; } } //if tentative spot has player and we are bad men, attack him! if (m.hostile_toplayer_currently && player.posx == tentx && player.posy == tenty) { MobAttacksMob(m, player.mob); didsomething = true; goto okhadfun; } //if spot is empty, move if (map.passablecheck(tentx, tenty, m)) { movemob(m, tentx, tenty); didsomething = true; goto okhadfun; } //if spot has mob and it's one we hate, attack it item_instance i = map.itemgrid[tentx, tenty]; //1.is there a mob there: if (i != null && i.ismob && (m.hostile_toenemies_currently && i.mob.hostile_toplayer_currently || m.hostile_toplayer_currently && i.mob.hostile_toenemies_currently)) { MobAttacksMob(m, i.mob); didsomething = true; } okhadfun: if (m.isplayer) { TimeEngine = CradleOfTime.player_is_done; return(true); } return(didsomething); }
void MobGetsToAct(mob e) { e.numattacksleft = e.archetype.attacks; e.nummovesleft = e.archetype.moves; e.usedDEFthisturn = false; //new kludge for horsies e.haveyoumovedthisgo = false; haveanothergofrederick: if (e.AIformob.randomlywalking)//randomlywalking might as well be "bool haveatarget" { //do a quickscan for targets if (map.spiralscan(e)) { //TARGET ACKWIERD. PRO-CEED. WE HAVE DIS-CO-VERED AN EN-EM-EH OF TEH DA-LECHS map.passable[e.posx, e.posy] = true; //we need square the mob starts on to be passable, for pathfinding. //attempt to move bool whattargetwas = map.passable[e.AIformob.targetsquare.x, e.AIformob.targetsquare.y]; if (map.PathfindAStar(e.posx, e.posy, e.AIformob.targetsquare.x, e.AIformob.targetsquare.y, false)) { int deltax = map.firststepx - e.posx; int deltay = map.firststepy - e.posy; trytomove(e, deltax, deltay); map.passable[e.posx, e.posy] = false; map.passable[e.AIformob.targetsquare.x, e.AIformob.targetsquare.y] = whattargetwas; //dodgy newbury // if (e.haveyoumovedthisgo) { return; } // else { e.haveyoumovedthisgo = true; log.Printline("frederick"); goto haveanothergofrederick; } //end dodgy newbury return; } } if (lil.randi(1, 100) < 5) { e.AIformob.direction = lil.randi(0, 7); //randomly change direction for no reason } if (trytomove(e, lil.deltax[e.AIformob.direction], lil.deltay[e.AIformob.direction])) { return; } e.AIformob.direction = lil.randi(0, 7);//change direction because couldn't move //dodgy newbury // if (e.haveyoumovedthisgo) { return; } // else { e.haveyoumovedthisgo = true; log.Printline("frederick"); goto haveanothergofrederick; } //end dodgy newbury return; } //if (e.IsAdjacentTo(player.mob) && // e.hostile_toplayer_currently) //{ // MobAttacksMob(e, player.mob); // return; //} }
bool checkforitemactivation(mob m, int tentx, int tenty) { return(false); //item_instance i = map.itemgrid[tentx, tenty]; //if (i == null) return false; //if (i.tile == Etilesprite.ITEM_BARREL) //{ // //open barrel // if (map.extradata[tentx, tenty] != null) // { // i.tile = (Etilesprite)map.extradata[tentx, tenty].x; //was Etilesprite.ITEM_WARP_BEADS; when there was only warp beads in barrels // if (i.tile == Etilesprite.ENEMY_HOPPED_UP_FOX) // { // i.ismob = true; // mob mm = new mob(Emobtype.fox); // mm.posx = tentx;mm.posy = tenty; // i.mob = mm; // map.moblist.Add(mm); // } // log.Printline("Inside the barrel was a "+Tilestuff.tilestring[(int)i.tile+2], Color.blue); // map.extradata[tentx, tenty] = null; // return true; // } // else // { // log.Printline("Take that, you barrel bastard!", Color.gray); // i.tile = Etilesprite.ITEM_BARREL_BROKEN; // map.extradata[tentx, tenty] = null; // return true; // } //} //else if (i.tile == Etilesprite.ITEM_BARREL_BROKEN) //{ // log.Printline(m.archetype.name + " plays cleanup!", Color.gray); // map.itemgrid[tentx, tenty] = null; // map.passable[tentx, tenty] = true; // return true; //} //else if (i.tile == Etilesprite.ITEM_WARP_BEADS) //{ // log.Printline(m.archetype.name + " collects the Warp Beads!", Color.magenta); // map.itemgrid[tentx, tenty] = null; // map.passable[tentx, tenty] = true; // m.hasbeads = true; // return true; //} //else if (i.tile == Etilesprite.ITEM_CAIRN_RED) //{ // log.Printline("The ", Color.gray); // log.Print("red cairn ", Color.red); // log.Print("repairs your body!"); // FloatingDamage(m, m, +5 + lil.randi(0, 10), "magic"); // i.tile = Etilesprite.ITEM_CAIRN_USED_RED; // map.dostaticlights(); // return true; //} //else if (i.tile == Etilesprite.ITEM_CAIRN_GREEN) //{ // log.Printline("The ", Color.gray); // log.Print("green cairn ", Color.green); // log.Print("is activated: nature is angry!"); // //now we want to reach out and strike 1-3 mobs on screen. if no mobs on screen it hits you! // //List<mob> mablist = map.moblist.Where(s => RLMap.Distance_Euclidean(s.posx, s.posy, tentx, tenty) < 10); // //later on figure out why this doesn't work // List<mob> mablist = new List<mob>(); // foreach (var mab in map.moblist) // { // if (RLMap.Distance_Euclidean(mab.posx, mab.posy, tentx, tenty) < 10) // mablist.Add(mab); // } // if (mablist.Count == 0) // { // //attack player // FloatingDamage(m, m, -5 - lil.randi(0, 5), "nature"); // } // else // { // foreach (var mab in mablist) // { // BresLineColour(tentx, tenty, mab.posx, mab.posy, true, false, colour_snakespit); // FloatingDamage(mab, mab, -5 - lil.randi(0, 5), "nature"); // } // } // i.tile = Etilesprite.ITEM_CAIRN_USED_GREEN; // map.dostaticlights(); // return true; //} //else if (i.tile == Etilesprite.ITEM_CAIRN_BLUE) //{ // log.Printline("The ", Color.gray); // log.Print("blue cairn ", Color.blue); // log.Print("lends you its power!"); // int which = lil.randi(1, 100); // if (which < 50 || (m.hasattackup && !m.hasdefenseup)) // { // log.Print(m.archetype.name + " gains the buff: defense up!", Color.blue); // //if (m.hasdefenseup) log.Print("Which " + m.archetype.name + " already had, oh well."); // m.hasdefenseup = true; // m.defenseuptimer += 15; // } // else // { // log.Print(m.archetype.name + " gains the buff: attack up!", Color.blue); // //if (m.hasattackup) log.Print("Which " + m.archetype.name + " already had, oh well."); // m.hasattackup = true; // m.attackuptimer += 15; // } // i.tile = Etilesprite.ITEM_CAIRN_USED_BLUE; // map.dostaticlights(); // return true; //} //else if (i.tile == Etilesprite.ITEM_CAIRN_PURPLE) //{ // log.Printline("The ", Color.gray); // log.Print("purple cairn ", Color.magenta); // log.Print("twists space around you!"); // int otherx = map.extradata[tentx, tenty].x; // int othery = map.extradata[tentx, tenty].y; // Cell c = Random9way(otherx, othery); // if (c == null) // { // log.Printline("The cairn should transport you", Color.blue); // log.Printline("but it is having problems!", Color.blue); // } // else // { // //if a mob uses this it's going to be messed up because need to change map.itemgrids // m.posx = c.x; m.posy = c.y; // cairntransport_effect(c.x, c.y); // } // item_instance i2 = map.itemgrid[otherx, othery]; // if (i2 == null) log.Printline("ERROR at receiving cairn."); // i.tile = Etilesprite.ITEM_CAIRN_USED_PURPLE; // i2.tile = Etilesprite.ITEM_CAIRN_USED_PURPLE; // map.dostaticlights(); // moveplayer(); // return true; //} ////new. pickup //else if (item_instance.holdable_items.Contains(i.tile)){ // Etilesprite prev = player.held; // log.Printline(m.archetype.name + " collects a "+Tilestuff.tilestring[(int)i.tile+2], Color.grey); // player.held = i.tile; // if (prev == Etilesprite.EMPTY) // { // map.itemgrid[tentx, tenty] = null; // map.passable[tentx, tenty] = true; // } // else // { // map.itemgrid[tentx, tenty].tile = prev; // log.Printline(m.archetype.name + " puts down a " + Tilestuff.tilestring[(int)prev + 2],Color.grey); // } // return true; //} //return false; }
// Use this for initialization void Start() { health = maxhealth = 250; if (redTexture == null) { redTexture = new Texture2D( 1, 1 ); redTexture.SetPixel( 0, 0, new Color(1f, 0.1f, 0.1f )); redTexture.Apply(); } if (redStyle == null) { redStyle = new GUIStyle(); redStyle.normal.background = redTexture; redStyle.normal.textColor = Color.red; redStyle.fontSize = 22; redStyle.alignment = TextAnchor.MiddleCenter; } if (greenTexture == null) { greenTexture = new Texture2D( 1, 1 ); greenTexture.SetPixel( 0, 0, new Color(0.1f, 1f, 0.1f )); greenTexture.Apply(); } if (greenStyle == null) { greenStyle = new GUIStyle(); greenStyle.normal.background = greenTexture; } textpos = new Rect(); bigfontstyle = new GUIStyle(); bigfontstyle.normal.textColor = Color.black; bigfontstyle.fontSize = 28; bigfontstyle.alignment = TextAnchor.MiddleCenter; smallfontstyle = new GUIStyle(); smallfontstyle.normal.textColor = Color.black; smallfontstyle.fontSize = 22; smallfontstyle.alignment = TextAnchor.MiddleCenter; GameObject[] dda = GameObject.FindGameObjectsWithTag("die"); int ii = 0; foreach ( GameObject dd in dda) { dice_scripts[ii++] = dd.GetComponent<die>(); } mob_script = mob_object.GetComponent<mob>(); reroll_btn_obj = GameObject.Find("reroll_sprite"); reroll_btn_script = reroll_btn_obj.GetComponent<reroll_btn>(); my_collider = GetComponent<BoxCollider2D>(); calculated = 0; Invoke("calculate", 0.25f); }
private void OnLoadMob(object sender, EventArgs e) { using (mobSel = new MobSelect(dHandle)) { DialogResult rst = mobSel.ShowDialog(); if (rst == DialogResult.OK) { tempMob = mobSel.selectedMob; } mobSel.Dispose(); } if (tempMob != null) { bMobIsNew = false; tboxMID.Text = tempMob.mID.ToString(); tboxMSprName.Text = tempMob.mSprName; tboxMEngName.Text = tempMob.mEngName; tboxMJpnName.Text = tempMob.mJpnName; tboxMLvl.Text = tempMob.mLvl.ToString(); tboxMHP.Text = tempMob.mHP.ToString(); tboxMSP.Text = tempMob.mSP.ToString(); tboxMBaseXP.Text = tempMob.mBaseXP.ToString(); tboxMJobXP.Text = tempMob.mJobXP.ToString(); tboxMAtkRng.Text = tempMob.mAtkRng.ToString(); tboxMMinAtk.Text = tempMob.mMinAtk.ToString(); tboxMMaxAtk.Text = tempMob.mMaxAtk.ToString(); tboxMDef.Text = tempMob.mDef.ToString(); tboxMMDef.Text = tempMob.mMDef.ToString(); tboxMStr.Text = tempMob.mStr.ToString(); tboxMAgi.Text = tempMob.mAgi.ToString(); tboxMVit.Text = tempMob.mVit.ToString(); tboxMInt.Text = tempMob.mInt.ToString(); tboxMDex.Text = tempMob.mDex.ToString(); tboxMLuk.Text = tempMob.mLuk.ToString(); tboxMSkRng.Text = tempMob.mSkRng.ToString(); tboxMVwRng.Text = tempMob.mVwRng.ToString(); setSelectedIndex(cboxMScale, tempMob.mScale); setSelectedIndex(cboxMRace, tempMob.mRace); tboxMEle.Text = tempMob.mEle.ToString(); setBehaviorBoxes(tempMob.mBevMask); tboxMWlkSpd.Text = tempMob.mWlkSpd.ToString(); tboxMAtkDly.Text = tempMob.mAtkDly.ToString(); tboxMAtkMot.Text = tempMob.mAtkMot.ToString(); tboxMDmgMot.Text = tempMob.mDmgMot.ToString(); tboxMMXP.Text = tempMob.mMXP.ToString(); setSelectedIndex(cboxMMDrop1ID, tempMob.mMDrop1ID); tboxMMDrop1Perc.Text = tempMob.mMDrop1Perc.ToString(); setSelectedIndex(cboxMMDrop2ID, tempMob.mMDrop2ID); tboxMMDrop2Perc.Text = tempMob.mMDrop2Perc.ToString(); setSelectedIndex(cboxMMDrop3ID, tempMob.mMDrop3ID); tboxMMDrop3Perc.Text = tempMob.mMDrop3Perc.ToString(); setSelectedIndex(cboxMDrop1ID, tempMob.mDrop1ID); tboxMDrop1Perc.Text = tempMob.mDrop1Perc.ToString(); setSelectedIndex(cboxMDrop2ID, tempMob.mDrop2ID); tboxMDrop2Perc.Text = tempMob.mDrop2Perc.ToString(); setSelectedIndex(cboxMDrop3ID, tempMob.mDrop3ID); tboxMDrop3Perc.Text = tempMob.mDrop3Perc.ToString(); setSelectedIndex(cboxMDrop4ID, tempMob.mDrop4ID); tboxMDrop4Perc.Text = tempMob.mDrop4Perc.ToString(); setSelectedIndex(cboxMDrop5ID, tempMob.mDrop5ID); tboxMDrop5Perc.Text = tempMob.mDrop5Perc.ToString(); setSelectedIndex(cboxMDrop6ID, tempMob.mDrop6ID); tboxMDrop6Perc.Text = tempMob.mDrop6Perc.ToString(); setSelectedIndex(cboxMDrop7ID, tempMob.mDrop7ID); tboxMDrop7Perc.Text = tempMob.mDrop7Perc.ToString(); setSelectedIndex(cboxMDrop8ID, tempMob.mDrop8ID); tboxMDrop8Perc.Text = tempMob.mDrop8Perc.ToString(); setSelectedIndex(cboxMDrop9ID, tempMob.mDrop9ID); tboxMDrop9Perc.Text = tempMob.mDrop9Perc.ToString(); setSelectedIndex(cboxMCardDropID, tempMob.mCardDropID); tboxMCardDropPerc.Text = tempMob.mCardDropPerc.ToString(); setSelectedIndex(cboxMobLocal, tempMob.mobLocale); } }