static void Main(string[] args) { PlayerRecord[] records = new PlayerRecord[2]; // records[0] = new PlayerRecord("Walle", Player.HOBBIT, 0); records[0] = new PlayerRecord("Gandalf", Player.MAGICIAN, 10000); // players[0] = Player.HUMAN; // records[1] = new PlayerRecord("Legolas", Player.ELF, 0); records[1] = new PlayerRecord("Bilbo", Player.HOBBIT, 0); // records[3] = new PlayerRecord("Aragorn", Player.HUMAN, 0); // records[4] = new PlayerRecord("Gimli", Player.DWARF, 0); // records[2] = new PlayerRecord("Walle", Player.ELF, 500000); // players[0] = Player.MAGICIAN; // names[0] = "Bilbo"; records[0].fCoins = 2; records[0].fArrows = 0; // records[4].fCoins = 0; // records[4].fArrows = 3; // records[0].fSandals = 1; // records[1].fSandals = 1; records[0].fStaffs[0] = Staff.NONE; // records[0].fStaffs[1] = Staff.GOLD; // records[0].fStaffs[2] = Staff.SILVER; // records[0].fStaffs[3] = Staff.PLATINUM; // records[0].fStaffs[4] = Staff.BRONZE; // records[1].fStaffs[0] = Staff.WOOD; // records[1].fStaffs[1] = Staff.BRONZE; // records[1].fStaffs[2] = Staff.SILVER; // records[1].fStaffs[3] = Staff.WOOD; records[0].fSwords = 3; records[1].fSwords = 3; records[0].fShields = 3; records[1].fShields = 3; records[0].fArmor = 5; records[1].fArmor = 5; // DungeonRecord dungeon = new DungeonRecord(1); DungeonRecord dungeon = new DungeonRecord(3); // DungeonRecord dungeon = new DungeonRecord(30); // DungeonRecord dungeon = new DungeonRecord(5); // dungeon.setName("crash on map-misc"); // // wound testing // int hp = 200; // PlayerRecord rec = records[0]; // RandomNumber rand = new RandomNumber(); // for (int i = 0; i < Player.kMaxWounds; i++) // { // rec.fWounds[i] = i + 1; // } // int heal = rand.range(1, 20); // for (int w = 0; w < Player.kMaxWounds; w++) // { // int wound = w + 1; // if (rec.fWounds[w] > 0 && heal >= wound) // { // int healtime = heal; // while (healtime >= wound && wound > 0) // { // healtime -= wound; // wound--; // } // if (wound > 0) // { // rec.fWounds[wound - 1] += rec.fWounds[w]; // hp -= wound * rec.fWounds[w]; // } // rec.fWounds[w] = 0; // } // } /* * Timespan t = new Timespan(4000); * Utility.Trace(t.toDisplayString()); * t = new Timespan(14000); * Utility.Trace(t.toDisplayString()); * t = new Timespan(814000); * Utility.Trace(t.toDisplayString()); * t = new Timespan(9814000); * Utility.Trace(t.toDisplayString()); * t = new Timespan(49814000); * Utility.Trace(t.toDisplayString()); */ Console console = new Console(); GameEngine c = new GameEngine(console, dungeon, records /*, names, coins, scores*/); Utility.Trace(c.toString()); console.setEngine(c); c.start(); }
public Player(PlayerRecord rec, Room room) { fCommands[4] = "Move"; rec.heal(); fPlayerRecord = rec; bool cheat = false; // cheat! fRace = rec.fRace; fWounds = rec.fWounds; Utility.Assert(fRace >= 1 && fRace <= 5, "Player.Player - fRace >= 1 && fRace <= 5"); fRoom = room; fLastRoom = room; this.setVisited(room); fExperienceLevel = 1; // fDragonSlayer = SLAYER_NOT; // for (int i = 0 ; i < kMaxNumStaffs ; i++) // fStaffCharges[i] = kDefaultCharge; fCoins = 0; fKeys = 0; fDragonSwords = 0; fSerpentShields = 0; fArmor = 0; fCarpets = 0; // fStaffs = 0; fArrows = 5; fAxes = 0; fWater = 20; fSandals = 0; fRing = RING_NONE; fArrowHits = 0; fAttacks = 1; fShots = 1; fBolts = 1; fBalls = 1; fMaxNumStaffs = 1; fLockPick = 0; fStrength = 0; fNoiseLevel = 2; fLastTarget = 0; fParalyzed = 0; fSwordCount = kSwordCount; fShieldCount = kShieldCount; fScore = 0; if (fRace == HOBBIT) { fNoiseLevel = 1; } // apply stuff from the record // fPlayers[no].setNumber(i + 1); this.fName = rec.fName; this.fCoins = rec.fCoins; this.updateScore(rec.fXP); this.fDragonSwords = rec.fSwords; this.fSerpentShields = rec.fShields; this.fArmor = rec.fArmor; this.fArrows = rec.fArrows; this.fCarpets = rec.fCarpets; this.fSandals = rec.fSandals; this.fKeys = rec.fKeys; this.fAxes = rec.fAxes; this.fRing = rec.fRing; this.applyExperience(); this.setStaffs(rec.fStaffs); this.fHitPoints = rec.fHP; fAttackCount = 0; fShotCount = 0; fArmorCount = kArmorCountMultiplier * fArmor; if (cheat) { fPlayerRecord.fXP = 1000; fCarpets = 1; fHitPoints = 100; fWater = 100; fCoins = 500; fKeys = 10; fAxes = 2; fRing = 1023; Staff bronze = new Staff(this, Staff.BRONZE); Staff silver = new Staff(this, Staff.SILVER); Staff gold = new Staff(this, Staff.GOLD); /* fStaffs.addStaff(silver); * fStaffs.addStaff(gold); * fStaffs.addStaff(bronze); * fStaffs.addStaff(new Staff(this, Staff.SILVER)); * fStaffs.addStaff(new Staff(this, Staff.BRONZE)); * fStaffs.addStaff(new Staff(this, Staff.BRONZE)); * Utility.Trace(fStaffs.toString()); * this.splinterStaff(gold); * Utility.Trace(fStaffs.toString()); */ // fStaffs = 3; fSandals = 1; } // if (fCoins < 5) // fCoins = 5; }