//---------------------------------------------------------------------- // Here, we are going to search the quadrant that it is ahead of the player, because // he is running //---------------------------------------------------------------------- public static bool FindAhead( PlayerMobile pm, Point3D centerPoint, ref Point3D spawnPoint, LandType landType, int distance, EffectType effectType, int effectHue ) { Direction dir = (Direction)((int)pm.Direction & 0x0f); Point3D foundPoint = new Point3D(); Tour tour = delegate( Map map, int x, int y ) { if( Utility.RandomDouble() < .5 ) return false; // break it up a little. Point2D currentPoint = new Point2D( pm.Location.X + x, pm.Location.Y + y ); if( FindSpawnTileInternal( pm, centerPoint, currentPoint, ref foundPoint, landType, effectType, effectHue ) ) { return true; } return false; }; bool found = Search.Octant( pm.Map, dir, distance, SearchDirection.Inwards, tour ); if( found ) { spawnPoint.X = foundPoint.X; spawnPoint.Y = foundPoint.Y; spawnPoint.Z = foundPoint.Z; return true; } return false; }
//Function called externally from UI buttons to roll for tracking skills public void TrackingSkillCheck() { //Telling the time panel how many hours will pass while tracking TimePanelUI.globalReference.AdvanceTime(this.hoursPassed); //Getting the reference to the tracking block of the tile that the player party is currently on List <EncounterBlock> trackingEncounters = PartyGroup.group1.GetComponent <WASDOverworldMovement>().currentTile.getTrackingEncounters(); //Int to hold the highest skill roll int highestRoll = 0; //Looping through each player character in the party for (int pc = 0; pc < PartyGroup.group1.charactersInParty.Count; ++pc) { //Making sure the current character slot isn't null if (PartyGroup.group1.charactersInParty[pc] != null) { //Rolling to see what the current character's skill check is int skillCheck = PartyGroup.group1.charactersInParty[pc].charSkills.GetSkillLevelValueWithMod(SkillList.Survivalist); skillCheck += Random.Range(1, 100); //If the current skill check is higher than the current highest, this check becomes the new highest if (skillCheck > highestRoll) { highestRoll = skillCheck; } } } //Looping through this tile's tracking encounter blocks to see what the highest success is int currentHighestIndex = -1; for (int t = 0; t < trackingEncounters.Count; ++t) { //If the current encounter's skill check is less than or equal to the best roll if (trackingEncounters[t].skillCheck <= highestRoll) { //If the current encounter's skill is higher than the current highest encounter's, it becomes the new highest if (currentHighestIndex < 0 || trackingEncounters[t].skillCheck > trackingEncounters[currentHighestIndex].skillCheck) { currentHighestIndex = t; } } } //If the current highest index is greater than -1, the player has succeeded and we start an encounter if (currentHighestIndex > -1) { //Getting the variables for the player party and tile to begin combat LandType tileType = PartyGroup.group1.GetComponent <WASDOverworldMovement>().currentTile.type; PartyGroup playerParty = PartyGroup.group1; //Telling the combat manager to start the fight CombatManager.globalReference.InitiateCombat(tileType, playerParty, trackingEncounters[currentHighestIndex].encounterEnemies); } }
public ActionResult Create([Bind(Include = "id,Name")] LandType landType) { if (ModelState.IsValid) { db.LandTypes.Add(landType); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(landType)); }
public Hex(LandType type) { landType = type; diceRollValue = -1; neighboringHexes = new Hex[6]; for (int i = 0; i < 6; ++i) neighboringHexes[i] = null; Points = new PointCollection(); }
//---------------------------------------------------------------------- // Opposite of the above; we want the first spawn location closest to // the center -- no closer than the initial distance //---------------------------------------------------------------------- public static bool FindOutwards( PlayerMobile pm, Point3D centerPoint, ref Point3D spawnPoint, LandType landType, int distance, EffectType effectType, int effectHue ) { return FindSpiral( pm, centerPoint, ref spawnPoint, landType, distance, false, effectType, effectHue ); }
private void OnCLEMInitialiseActivity(object sender, EventArgs e) { if (LandItemNameToUse != null && LandItemNameToUse != "") { // locate Land Type resource for this forage. LinkedLandItem = Resources.FindResourceType <Land, LandType>(this, LandItemNameToUse, OnMissingResourceActionTypes.ReportErrorAndStop, OnMissingResourceActionTypes.ReportErrorAndStop); if (UseAreaAvailable) { LinkedLandItem.TransactionOccurred += LinkedLandItem_TransactionOccurred; } } }
// GET: LandTypes/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } LandType landType = db.LandTypes.Find(id); if (landType == null) { return(HttpNotFound()); } return(View(landType)); }
private void FixSpot(Point point, Tile[,] tileGrid) { Point nextPoint = point; for (int i = 2; i < 7; i += 1) { if (CreatingWorld.IsRoad(tileGrid, nextPoint)) { int id = tileGrid[nextPoint.X, nextPoint.Y].tileLogistic.roadId; if (id < 12) //Lets try do every road { LandType landtype = tileGrid[nextPoint.X, nextPoint.Y].tileLogistic.landType; tileGrid[nextPoint.X, nextPoint.Y].SetTileLogistic(TileLogisticsController.GetTileLogistic(landtype, id + 12)); } } nextPoint = AngleStuff.AddPointToDirection(point, i); } }
//Empty constructor for this class public TileInfo() { //Setting this tile's type as "Empty" this.type = LandType.Empty; //Initializing the (now empty) list of objects on this tile this.objectsOnThisTile = new List <GameObject>(); this.connectedTiles = new List <TileInfo>(); for (int c = 0; c < 6; ++c) { this.connectedTiles.Add(null); } //Initializing the list of tile coordinates for connected tiles this.connectedTileCoordinates = new List <GridCoordinates>(); for (int t = 0; t < 6; ++t) { this.connectedTileCoordinates.Add(null); } }
public void changeBg(LandType land) { if (land == LandType.GREENLAND) { background.sprite = Resources.Load <Sprite>("Bg/greenland_bg"); AudioManager.instance.changeBg("greenlandbg"); } else if (land == LandType.RUINLAND) { background.sprite = Resources.Load <Sprite>("Bg/ruinland_bg"); AudioManager.instance.changeBg("ruinlandbg"); } else { background.sprite = Resources.Load <Sprite>("Bg/sandland_bg"); AudioManager.instance.changeBg("sandlandbg"); } }
//--------------------------------------------------------------------- // Ctor //--------------------------------------------------------------------- public RandomEncounter( XmlNode node, string facet, string regionType, string regionName, string probability, string shortest, string farthest, string landType, string time, string level, string levelType, string scaleUp ) { m_XmlNode = node; m_Facet = facet; m_RegionType = regionType; m_RegionName = regionName; if (probability == "*") { m_Probability = -1; m_Inclusive = true; } else { m_Probability = float.Parse(probability, RandomEncounterEngine.Language); m_Inclusive = false; } m_Shortest = int.Parse(shortest); m_Farthest = int.Parse(farthest); m_LandType = (LandType)Enum.Parse(typeof(LandType), landType); m_EncounterTime = (EncounterTime)Enum.Parse(typeof(EncounterTime), time); m_Level = double.Parse(level); m_LevelType = (LevelType)Enum.Parse(typeof(LevelType), levelType); m_ScaleUp = bool.Parse(scaleUp); m_Elements = new ArrayList(); }
public override void LoadRules(FileFormats.IniFile.IniSection rules) { base.LoadRules(rules); Land = rules.ReadEnum("Land", LandType.Clear); Strength = rules.ReadInt("Strength", 1); Wall = rules.ReadBool("Wall"); Tiberium = rules.ReadBool("Tiberium"); Crate = rules.ReadBool("Crate"); CrateTrigger = rules.ReadBool("CrateTrigger"); Explodes = rules.ReadBool("Explodes"); Overrides = rules.ReadBool("Overrides"); CellAnim = Get<Animation>(rules.ReadString("CellAnim")); DamageLevels = rules.ReadInt("DamageLevels", 1); RadarColor = rules.ReadColor("RadarColor"); NoUseLandTileType = rules.ReadBool("NoUseLandTileType", true); IsVeinholeMonster = rules.ReadBool("IsVeinholeMonster"); IsVeins = rules.ReadBool("IsVeins"); ChainReaction = rules.ReadBool("ChainReaction"); DrawFlat = rules.ReadBool("DrawFlat", true); IsARock = rules.ReadBool("IsARock"); IsRubble = rules.ReadBool("IsRubble"); }
//Empty constructor for this class public TileInfo() { //Setting this tile's type as "Empty" this.type = LandType.Empty; //Initializing the (now empty) list of objects on this tile this.objectsOnThisTile = new List <GameObject>(); this.connectedTiles = new List <TileInfo>(); for (int c = 0; c < 6; ++c) { this.connectedTiles.Add(null); } //Initializing the list of tile coordinates for connected tiles this.connectedTileCoordinates = new List <GridCoordinates>(); for (int t = 0; t < 6; ++t) { this.connectedTileCoordinates.Add(null); } //Initializing the empty list of forage resources, fishing resources, and tracking encounters this.foragingResources = new List <ResourceBlock>(); this.fishingResources = new List <ResourceBlock>(); this.trackingEncounters = new List <EncounterBlock>(); }
public override void LoadRules(FileFormats.IniFile.IniSection rules) { base.LoadRules(rules); DeployToFire = rules.ReadBool("DeployToFire"); IsSimpleDeployer = rules.ReadBool("IsSimpleDeployer"); Harvester = rules.ReadBool("Harvester"); Weeder = rules.ReadBool("Weeder"); SpeedType = rules.ReadEnum("SpeedType", SpeedType.Clear); IsTilter = rules.ReadBool("IsTilter"); CarriesCrate = rules.ReadBool("CarriesCrate"); TooBigToFitUnderBridge = rules.ReadBool("TooBigToFitUnderBridge"); HalfDamageSmokeLocation = rules.ReadXYZ("HalfDamageSmokeLocation"); UseTurretShadow = rules.ReadBool("UseTurretShadow"); Passive = rules.ReadBool("Passive"); MovementRestrictedTo = rules.ReadEnum("MovementRestrictedTo", LandType.Clear); CanBeach = rules.ReadBool("CanBeach"); SmallVisceroid = rules.ReadBool("SmallVisceroid"); LargeVisceroid = rules.ReadBool("LargeVisceroid"); NonVehicle = rules.ReadBool("NonVehicle"); BurstDelayX = rules.ReadInt("BurstDelayX", -1); AltImage = rules.ReadString("AltImage"); CrateGoodie = rules.ReadBool("CrateGoodie"); }
protected virtual LandType GetLandTypeFromPower(int power) { LandType landType = LandType.GROUND; if (power < -1) { landType = LandType.GROUND; } else if (power < 2) { landType = LandType.SAND; } else if (power < 20) { landType = LandType.STONE; } else { landType = LandType.SNOW; } return(landType); }
public override void LoadRules(FileFormats.IniFile.IniSection rules) { base.LoadRules(rules); Land = rules.ReadEnum("Land", LandType.Clear); Strength = rules.ReadInt("Strength", 1); Wall = rules.ReadBool("Wall"); Tiberium = rules.ReadBool("Tiberium"); Crate = rules.ReadBool("Crate"); CrateTrigger = rules.ReadBool("CrateTrigger"); Explodes = rules.ReadBool("Explodes"); Overrides = rules.ReadBool("Overrides"); CellAnim = Get <Animation>(rules.ReadString("CellAnim")); DamageLevels = rules.ReadInt("DamageLevels", 1); RadarColor = rules.ReadColor("RadarColor"); NoUseLandTileType = rules.ReadBool("NoUseLandTileType", true); IsVeinholeMonster = rules.ReadBool("IsVeinholeMonster"); IsVeins = rules.ReadBool("IsVeins"); ChainReaction = rules.ReadBool("ChainReaction"); DrawFlat = rules.ReadBool("DrawFlat", true); IsARock = rules.ReadBool("IsARock"); IsRubble = rules.ReadBool("IsRubble"); }
/// <summary> /// Builds the 'Land' subsection /// </summary> /// <param name="nab">Source NABSA</param> public IEnumerable <LandType> GetLandTypes(Land land) { List <LandType> types = new List <LandType>(); var items = LandSpecs.Elements().ToArray(); for (int i = 2; i < items.Length; i++) { var data = items[i].Elements().ToArray(); if (data[0].Value != "0") { LandType type = new LandType(land) { Name = items[i].Name.LocalName, LandArea = Convert.ToDouble(data[0].Value), SoilType = Convert.ToInt32(data[3].Value) }; types.Add(type); } } return(types); }
//--------------------------------------------------------------------- // Ctor //--------------------------------------------------------------------- public RandomEncounter( XmlNode node, string facet, string regionType, string regionName, string probability, string shortest, string farthest, string landType, string time, string level, string levelType, string scaleUp ) { m_XmlNode = node; m_Facet = facet; m_RegionType = regionType; m_RegionName = regionName; if( probability=="*" ) { m_Probability = -1; m_Inclusive = true; } else { m_Probability = float.Parse( probability, RandomEncounterEngine.Language ); m_Inclusive = false; } m_Shortest = int.Parse( shortest ); m_Farthest = int.Parse( farthest ); m_LandType = (LandType) Enum.Parse( typeof( LandType ), landType ); m_EncounterTime = (EncounterTime) Enum.Parse( typeof( EncounterTime ), time ); m_Level = double.Parse( level ); m_LevelType = (LevelType) Enum.Parse( typeof( LevelType ), levelType ); m_ScaleUp = bool.Parse( scaleUp ); m_Elements = new ArrayList(); }
void setLandTypeNet(int type) { this.myType = (LandType)type; }
public void setLandType(LandType type) { this.myType = type; }
//---------------------------------------------------------------------- // Here we do the actual work of studying tiles to see if they are suitable // for spawn; if something is wrong with the spawn finder, it's probably // here //---------------------------------------------------------------------- private static bool FindSpawnTileInternal( PlayerMobile pm, Point3D centerPoint, Point2D currentPoint, ref Point3D spawnPoint, LandType landType, EffectType effectType, int effectHue ) { Map map = pm.Map; Region sourceRegion = pm.Region; LandTile landTile = map.Tiles.GetLandTile( centerPoint.X, centerPoint.Y ); LandTile spawnTile = map.Tiles.GetLandTile( currentPoint.X, currentPoint.Y ); StaticTile[] staticTiles = map.Tiles.GetStaticTiles( currentPoint.X, currentPoint.Y, true ); Region r = Region.Find( new Point3D( currentPoint.X, currentPoint.Y, landTile.Z ), map ); if( r.GetType() != sourceRegion.GetType() ) { //Console.WriteLine( "player.Location="+pm.Location ); //Console.WriteLine( "rquery={0},{1}", currentPoint.X, currentPoint.Y ); //Console.WriteLine( "sourceRegion="+sourceRegion.GetType() ); //Console.WriteLine( "r="+r.GetType() ); return false; } if( r is HouseRegion ) return false; //-------------------------------------------------------------- // WATER LOCATION: //-------------------------------------------------------------- if( (TileData.LandTable[spawnTile.ID & 0x3FFF].Flags & TileFlag.Wet) == TileFlag.Wet ) { if( landType != LandType.Water ) return false; // water tile, isn't a water encounter //---------------------------------------------------------- // Instead of the CanSpawn function we use can fit, as it allows us to not require // a surface (which defaults to true otherwise) //---------------------------------------------------------- if( map.CanFit( currentPoint.X, currentPoint.Y, spawnTile.Z, 16, true, true, false ) ) { spawnPoint.X = currentPoint.X; spawnPoint.Y = currentPoint.Y; spawnPoint.Z = spawnTile.Z; return true; } //---------------------------------------------------------- // XXX -- note; there is a degenerate case where the static and not the land tile // determines water. This is along coastlines, and in rivers and the like; // may be useful later, as we can take "Wet" cells to generally be "at sea". // For now, though, we are ignoring these static wet tiles. One reason for // this is that if we don't we could end up getting dolphins in small // inland lakes. //---------------------------------------------------------- } //-------------------------------------------------------------- // LAND LOCATION: //-------------------------------------------------------------- else { if( landType == LandType.Water ) return false; // land tile, isn't a land encounter // search for wet static tiles; these are coastal cells; // if we we want land, we don't want to spawn in cells like these: bool foundWet = false; foreach( StaticTile staticTile in staticTiles ) { if( (TileData.ItemTable[staticTile.ID].Flags & TileFlag.Wet) == TileFlag.Wet ) { foundWet = true; break; } } if( foundWet ) { return false; } //if( RandomEncounterEngine.DebugEffect ) //Effects.SendLocationParticles( //EffectItem.Create( new Point3D( currentPoint.X, currentPoint.Y, centerPoint.Z), map, EffectItem.DefaultDuration ), //0x37CC, 1, 40, 36, 3, 9917, 0 //); // we will probe highest to lowest if the player is above ground level (e.g, they are in a tower), // or lowest to highest otherwise: ArrayList staticTileArray = new ArrayList( staticTiles ); staticTileArray.Sort( new TileComparer() ); if( centerPoint.Z > landTile.Z ) staticTileArray.Reverse(); foreach( StaticTile staticTile in staticTileArray ) { if( map.CanSpawnMobile( currentPoint.X, currentPoint.Y, staticTile.Z ) ) { spawnPoint.X = currentPoint.X; spawnPoint.Y = currentPoint.Y; spawnPoint.Z = staticTile.Z; if( RandomEncounterEngine.DebugEffect ) Effects.SendLocationParticles( EffectItem.Create( new Point3D( spawnPoint.X, spawnPoint.Y, spawnPoint.Z ), map, EffectItem.DefaultDuration ), 0x37CC, 1, 40, 96, 3, 9917, 0 ); else if( effectType != EffectType.None ) { EffectEntry effect = EffectEntry.Lookup[(int)effectType]; Effects.SendLocationParticles( EffectItem.Create( new Point3D( spawnPoint.X, spawnPoint.Y, spawnPoint.Z ), map, EffectItem.DefaultDuration ), effect.Animation, effect.Speed, effect.Duration, effectHue, effect.RenderMode, effect.Effect, 0 ); } //Console.WriteLine("Found good point at static.Z"); return true; } //if( RandomEncounterEngine.DebugEffect ) //Effects.SendLocationParticles( //EffectItem.Create( new Point3D( currentPoint.X, currentPoint.Y, staticTile.Z), map, EffectItem.DefaultDuration ), //0x37CC, 1, 40, 36, 3, 9917, 0 //); } // probe spawn tile Z if( map.CanSpawnMobile( currentPoint.X, currentPoint.Y, spawnTile.Z ) ) { spawnPoint.X = currentPoint.X; spawnPoint.Y = currentPoint.Y; spawnPoint.Z = spawnTile.Z; if( RandomEncounterEngine.DebugEffect ) Effects.SendLocationParticles( EffectItem.Create( new Point3D( spawnPoint.X, spawnPoint.Y, spawnPoint.Z ), map, EffectItem.DefaultDuration ), 0x37CC, 1, 40, 36, 3, 9917, 0 ); else if( effectType != EffectType.None ) { EffectEntry effect = EffectEntry.Lookup[(int)effectType]; Effects.SendLocationParticles( EffectItem.Create( new Point3D( spawnPoint.X, spawnPoint.Y, spawnPoint.Z ), map, EffectItem.DefaultDuration ), effect.Animation, effect.Speed, effect.Duration, effectHue, effect.RenderMode, effect.Effect, 0 ); } //Console.WriteLine("Found good point at search point.Z"); return true; } // probe player tile Z if( map.CanSpawnMobile( currentPoint.X, currentPoint.Y, centerPoint.Z ) ) { spawnPoint.X = currentPoint.X; spawnPoint.Y = currentPoint.Y; spawnPoint.Z = centerPoint.Z; if( RandomEncounterEngine.DebugEffect ) Effects.SendLocationParticles( EffectItem.Create( new Point3D( spawnPoint.X, spawnPoint.Y, spawnPoint.Z ), map, EffectItem.DefaultDuration ), 0x37CC, 1, 40, 167, 3, 9917, 0 ); else if( effectType != EffectType.None ) { EffectEntry effect = EffectEntry.Lookup[(int)effectType]; Effects.SendLocationParticles( EffectItem.Create( new Point3D( spawnPoint.X, spawnPoint.Y, spawnPoint.Z ), map, EffectItem.DefaultDuration ), effect.Animation, effect.Speed, effect.Duration, effectHue, effect.RenderMode, effect.Effect, 0 ); } //Console.WriteLine("Found good point at center point.Z"); return true; } //if( RandomEncounterEngine.DebugEffect ) //Effects.SendLocationParticles( //EffectItem.Create( new Point3D( currentPoint.X, currentPoint.Y, spawnTile.Z), map, EffectItem.DefaultDuration ), //0x37CC, 1, 40, 36, 3, 9917, 0 //); } return false; }
//---------------------------------------------------------------------- // Implementation of the find spiral pattern; supports inwards from // distance, and outwards from distance searches //---------------------------------------------------------------------- private static bool FindSpiral( PlayerMobile pm, Point3D centerPoint, ref Point3D spawnPoint, LandType landType, int distance, bool inwards, EffectType effectType, int effectHue ) { Point3D foundPoint = new Point3D(); Tour tour = delegate( Map map, int x, int y ) { Point2D currentPoint = new Point2D( pm.Location.X + x, pm.Location.Y + y ); if( FindSpawnTileInternal( pm, centerPoint, currentPoint, ref foundPoint, landType, effectType, effectHue ) ) { return true; } return false; }; bool found = Search.Spiral( pm.Map, distance, inwards ? SearchDirection.Inwards : SearchDirection.Outwards, true, tour ); if( found ) { spawnPoint.X = foundPoint.X; spawnPoint.Y = foundPoint.Y; spawnPoint.Z = foundPoint.Z; return true; } return false; }