//overwrite original virtual method declared in Property class public override string landOn(ref Player player) { //if the following is a jail property and player has gone past then set player in jail if(this.isJail == true) { //enable setIsInJail to true player.setIsInJail(); //don't let player pass GO and don't let collect $200 player.setLocation(10, false); return null; //return base.landOn(ref player) + String.Format(player.getName() + " has gone to jail!"); } else { if(player.getJailStats() == true) { return null; //return base.landOn(ref player) + String.Format(player.getName() + " you're now in jail, you cannot pass Go or collect $200.00\nTo Get out of jail you must:\n \t-pay $50\n \t-use a 'Get out of Jail Card'\n \t-or attempt to roll doubles.\n"); } else { return base.landOn(ref player) + String.Format(player.getName() + " is visiting jail!"); } //when player is only visiting Jail //player.setNotInJail(); } }
public override string landOn(ref Player player) { if (this.setJail == true) { Console.WriteLine("You have gone to jail, you do not pass go you can not collect $200\n"); player.setIsInJail(); player.setLocation(10, false); return base.landOn(ref player) + String.Format(player.getName().ToString() + " has gone to jail!"); } else { if (player.getJailStatis() == true) { if (player.sendMsg == false) { return null; } return base.landOn(ref player) + String.Format(player.getName().ToString() + " is in jail!.."); } return base.landOn(ref player) + String.Format(player.getName().ToString() + " is just visiting!."); } }