public void addStaff(Staff staff) { if (fStaffs == null) { fStaffs = new StaffContainer(); } fStaffs.addStaff(staff); }
public void unlockChest() { Utility.Assert(this.hasChest(), "Room.unlockChest - this.hasChest()"); Utility.Assert(fChest.fLocked, "Room.unlockChest - fChest.isLocked()"); fChest.fLocked = false; // transfer the contents to the room this.fCoins = this.fCoins + fChest.fCoins; fChest.fCoins = 0; this.fKeys = this.fKeys + fChest.fKeys; fChest.fKeys = 0; this.fDragonSwords = this.fDragonSwords + fChest.fDragonSwords; fChest.fDragonSwords = 0; this.fSerpentShields = this.fSerpentShields + fChest.fSerpentShields; fChest.fSerpentShields = 0; this.fArmor = fChest.fArmor; fChest.fArmor = 0; this.fCarpets = this.fCarpets + fChest.fCarpets; fChest.fCarpets = 0; this.fStaffs = fChest.fStaffs; fChest.fStaffs = null; this.fArrows = this.fArrows + fChest.fArrows; fChest.fArrows = 0; this.fAxes = this.fAxes + fChest.fAxes; fChest.fAxes = 0; this.fSandals = this.fSandals + fChest.fSandals; fChest.fSandals = 0; this.fRing = this.fRing + fChest.fRing; fChest.fRing = 0; }
public void createChest() { Utility.Assert(!this.hasChest(), "Room.createChest - !this.hasChest()"); Utility.Assert(!this.hasDoor(), "Room.createChest - !this.hasDoor()"); fChest = new Chest(); // transfer all items to the chest fChest.fCoins = this.fCoins + GameEngine.rand.range(0, GameEngine.instance.fDungeon.fNumber); this.fCoins = 0; fChest.fKeys = this.fKeys; this.fKeys = 0; fChest.fDragonSwords = this.fDragonSwords; this.fDragonSwords = 0; fChest.fSerpentShields = this.fSerpentShields; this.fSerpentShields = 0; fChest.fArmor = this.fArmor; this.fArmor = 0; fChest.fCarpets = this.fCarpets; this.fCarpets = 0; fChest.fStaffs = this.fStaffs; this.fStaffs = null; fChest.fArrows = this.fArrows; this.fArrows = 0; fChest.fAxes = this.fAxes; this.fAxes = 0; fChest.fSandals = this.fSandals; this.fSandals = 0; fChest.fRing = this.fRing; this.fRing = 0; }
public void insertStaffs(Player owner, StaffContainer staffs) { // StaffContainer left = new StaffContainer(); while (true) { Staff best = staffs.getBestStaff(); if (best == null) { break; } staffs.removeStaff(best); best.setOwner(owner); Staff drop = this.addStaff(best); if (drop != null) { staffs.addStaff(drop); if (drop == best) { break; } } } }
public void pickUpStaffs(StaffContainer staffs) { fStaffs.insertStaffs(this, staffs); }