3NSh=-bYeABCJOWE-+@6oNGOxUKVvb2L3aZ!?F>XG_F+<^@Aoom5HwRYE?>ZUZBpAh2
z{-h^rAK~cm-+$le`QPPSipR41`HG6PeWtGT5MQ$E<1OX$6LgK?F6fS)c5COZZ(Rp<
extG4)$0)FH+Q+8b@+*Ofg~8L+&t;ucLK6Ui2me3-
literal 0
HcmV?d00001
diff --git a/Game1/Content/SugarcaneIcon.png b/Game1/Content/SugarcaneIcon.png
new file mode 100644
index 0000000000000000000000000000000000000000..e2f173b05d77516c9b1bc271c64e16a9350d9a27
GIT binary patch
literal 1729
zcmV;y20rPx#1ZP1_K>z@;j|==^1poj532;bRa{vGmbN~PnbOGLGA9w%&23AQ#K~#8N?VCML
z9Z3*?hm9aI(k6sxBZ9pEHz4rJS0Jzi9D$HiKt@PxttGC&5r_;Kq|V6Lt;dvIF85z`
zRrho^^GPG#!%WXief87tN#2^K>Gl6(r4jy^f37sbj|zExT?=JNwzfb86N0~7sSAz$
z+OisB719{Px2(Uue4JlR)3;Aw=T~h(V?VSIDudFRn0G%ze4<)l*a`^+-MT{fwWRC6
zi)p%{D#Z${LOd)OPDrSQ
zlxS7F0+HNntse}Huxg7#4Ry>~+CDH)C91=99YA`m;fK1fjaWciBE1gE(TX3YLTb+r
z7rECNzCub7l3~RVLTXe;Oor8U)(SDevL$ve1Tq&tn9&2MRUI)T=XXEUOSdarA0)eW
zZn10d`*Z#MFhjkx430$w#;RqVApvOc@H2<2N__Z&ACh7!|vw7>r|gW&b$E1&$;tfNH>}!L>FNM5fLuzB3@O<{uCK3utBiw#
zgCDJnw=m1L70O@@G@w2yxuhmbmJq0py}iBpT^bf`3j;=jg#pu6N2t{Rn(C0;n^*|8
zsvInLTM#Tfw1k2Q>(^*ih**fLRi&b7TUHrZ8|l4?zsrKZ(~$FhSu6uJLbPk+`Fz%-
zR2Gu`T^6*fR
z0c6b(8hrR_BzLD}MXn4Vv^qk>l0-|A5I)S|ed+I~NJKKy{s+
zoz3t3{Q3Fs`PENSTZ#{@3^?C6cQi6YGlb6$4XH9pWid+jwWrX!u6vTqoe-iKLM!9$
z?rwf114O_DQ)I-*eQ*dU2G6zK%~{t%1}7@y;^JcS6M}kpc(@6y^pJ>%RYwkVO_!8d
zKtuOrDFcYMtlE@#_?YC-x|(xS5w)zE#2!9})@5*-5)vZk;jID+?F|p4gbbh=As9UR
z@H7Cm;W9%T0!x~iA)#!}$wvA)27^fnty#NOH8(?I0gwXgfdrb>G_y4UE!C=!=4XgD
z04T;)B`&NhRm$Q*XaFqchNj(ES85K6&k+8d70qO6MwXOOvO1cXAs7T{Td7TrR)s9y
zvV0Pjs19tI+P0}-F(I)4N`SROL6o#AUa2*!188EG#j`Ru2-@uC)mmEyu*guSEdt5S
z%2=gIs)JKY2#x)sLR`Ez8Ni~utXLpgpr#B?RUwvHS+Y8oq=}&}rKF4{s{^Pega?A}
zh9rT=-A&;=;Q5++C`Hu@@dZKx1QmB=xk06$HMI9*O_g01%}l=62U0WB)ow7Dux@A_
z*SVA>t7EZUmP>{fn(aPXmcc15#3~p)1yw`!T~VKLU1>Qhb5!Q;Ft>024$3>
zYG`Jc1u}Bx4S*u?e7;UkBF$!qE4v{m*s@Zqg9eheJKy;uR8{dA!ZS1m4XSJI9)aw$GgzAFKGs1A-v%hI%s-2XeyuStc#T0P02u~!Rm$)Ht|QXM>)
zNU97My$Ug#A=oykj1V-a@VBwQm(Y_8j;cavP(cI_YD#tZ$gPeZWfZ9pNrta7{A3F$
z71UH{i^MiL0%k3XW1ZzAR|k!~N(jP(waSoTE+hw6kX?a|$pBU%#$eDxLR@nKHWIzd
z0GboxWAs*q(AXFGa&aY}rYi(Voj1MGP0Ml-nm4`DwU80<3Rzi>--N8R!Me+8ifQ@}
XY#PIgbTVum00000NkvXXu0mjf!U_~5
literal 0
HcmV?d00001
diff --git a/Game1/Content/TobaccoIcon.png b/Game1/Content/TobaccoIcon.png
new file mode 100644
index 0000000000000000000000000000000000000000..9a2b8df83788f4f8423e6e946893e1439ed89bab
GIT binary patch
literal 747
zcmeAS@N?(olHy`uVBq!ia0vp^DImnOr`O^7Mbe;Qt@TE#iNyX1M_oqppn>Tgq1xe)%0zHKdHZS;+lT>}DHZ5eBnfWP2
zXTg#r4F|QV9m~=JbPPlk7Kh!HR2I?ZIa(jt9G2L#X~xZhZ*wN>+iP%)vFH?cTbA4r
z;kGQPBhqbIVn>wQvV@Lkw`K7iF>cG^I%3_H#kPcn=PHYbro^hM36l&$t|}}|T#@DI
zbtE9PX-e0^Rm_@_&Y`S9R&A@;may@JvU=!Btg4tW%OK>U!q&tUNsd`Z0$iJ}bS>;+
zUMcA;${J+drp2~|l_!+NLtEmMt%tY7DN~PZiBq~B-4dr%JyuJclJz((aZ1$VwZti2
z4vFb84GkZ!zEeoJvt64*;{I)3mY$bojEu?q&N?2bxU)oNG2TRW%)!0|wje>Dz0tSz`m?EuH3?6aYDS97fQ(n7bs;PO2!KLnf&c_b3A6~Y^
zJC@^mdyW^A;%|mRXmnd}3#2nX(s7u>+OZiS=q-PF-u|5epIO;9z5dntleeYj$f=^x
b>wnpseHC4_T7y)836#Op)z4*}Q$iB}$Hysb
literal 0
HcmV?d00001
diff --git a/Game1/Game1.cs b/Game1/Game1.cs
index eb3a5f7..a1372d0 100644
--- a/Game1/Game1.cs
+++ b/Game1/Game1.cs
@@ -14,7 +14,7 @@ namespace Game1
SpriteBatch spriteBatch;
SpriteFont Bold;
private Texture2D[] tile = new Texture2D[5];
- private Texture2D[] Crops = new Texture2D[5];
+ private Texture2D[] Crops = new Texture2D[11];
private Texture2D tractor;
private Texture2D house;
private Texture2D markers;
@@ -95,13 +95,23 @@ namespace Game1
tile[0] = Content.Load("Mountain");
tile[1] = Content.Load("tileunplantable");
tile[2] = Content.Load("Plantable");
- tile[3] = Content.Load("Planted");
- tile[4] = Content.Load("Crop");
+ tile[3] = Content.Load("Crop");
Crops[0] = Content.Load("CarrotIcon");
Crops[1] = Content.Load("WheatIcon");
- Crops[2] = Content.Load("BerriesIcon"); //Replace 2 and 3 with the new crop Textures
- Crops[3] = Content.Load("TreePlantationIcon");
+ Crops[2] = Content.Load("BerriesIcon");
+
+
+
+ Crops[3] = Content.Load("MaizeIcon");
+ Crops[4] = Content.Load("MilletsIcon");
+ Crops[5] = Content.Load("SeedOilIcon");
+ Crops[6] = Content.Load("PaddyIcon");
+ Crops[7] = Content.Load("PulsesIcon");
+ Crops[8] = Content.Load("SugarcaneIcon");
+ Crops[9] = Content.Load("TobaccoIcon");
+ Crops[10] = Content.Load("WheatIcon");
+
ProgressionBar = Content.Load("ProgressionBar");
ProgressionBarStatus = Content.Load("ProgressionBarStatus");
@@ -217,6 +227,9 @@ namespace Game1
for (int j = 0; j < input.getSize().Y; j++)
{
Rectangle tilePos = new Rectangle(i * (input.getSpacingTile()), j * (input.getSpacingTile()), input.getTileSize(), input.getTileSize());
+
+
+
spriteBatch.Draw(tile[tractorUnit.getFarm().getCrop(i, j).getStatus()], tilePos, Time.GetTimeOfDay());
if (tilePos.Intersects(mousePosition))
{
@@ -232,15 +245,22 @@ namespace Game1
x = i;
y = j;
}
+ if (tractorUnit.getFarm().getCrop(i, j).getStatus() != 0 && tractorUnit.getFarm().getCrop(i, j).getStatus() != 1)
+ {
+ spriteBatch.Draw(Crops[tractorUnit.getFarm().getCrop(i, j).getCropType()], new Rectangle(i * input.getSpacingTile(), j * input.getSpacingTile(), input.getTileSize(), input.getTileSize()), Color.White);
+ }
}
- if ((tractorUnit.getFarm().getCrop(i, j).getStatus() == 4))
+ else
{
- spriteBatch.Draw(ProgressionBar, new Rectangle(i * (input.getSpacingTile()) + input.getTileSize() - input.getTileSize() / 3, j * (input.getSpacingTile()), input.getTileSize() / 3, input.getTileSize()), Color.White);
- spriteBatch.Draw(ProgressionBarStatus, new Rectangle(i * (input.getSpacingTile()) + input.getTileSize() - input.getTileSize() / 4, j * (input.getSpacingTile()) + input.getTileSize() / 3, input.getTileSize() / 4, tractorUnit.getFarm().getCrop(i, j).getCropTimerBar((input.getTileSize())) + 1), Color.White);
- }
- if (tractorUnit.getFarm().getCrop(i, j).getStatus() != 0 && tractorUnit.getFarm().getCrop(i, j).getStatus() != 1)
- {
- spriteBatch.Draw(Crops[tractorUnit.getFarm().getCrop(i, j).getCropType()], new Rectangle(i * (input.getSpacingTile()) + input.getTileSize() - input.getTileSize() / 3, j * (input.getSpacingTile()), input.getTileSize() / 3, input.getTileSize() / 3), Color.White);
+ if (tractorUnit.getFarm().getCrop(i, j).getStatus() != 0 && tractorUnit.getFarm().getCrop(i, j).getStatus() != 1)
+ {
+ if ((tractorUnit.getFarm().getCrop(i, j).getStatus() == 3))
+ {
+ spriteBatch.Draw(ProgressionBar, new Rectangle(i * (input.getSpacingTile()) + input.getTileSize() - input.getTileSize() / 3, j * (input.getSpacingTile()), input.getTileSize() / 3, input.getTileSize()), Color.White);
+ spriteBatch.Draw(ProgressionBarStatus, new Rectangle(i * (input.getSpacingTile()) + input.getTileSize() - input.getTileSize() / 4, j * (input.getSpacingTile()) + input.getTileSize() / 3, input.getTileSize() / 4, tractorUnit.getFarm().getCrop(i, j).getCropTimerBar((input.getTileSize())) + 1), Color.White);
+ }
+ spriteBatch.Draw(Crops[tractorUnit.getFarm().getCrop(i, j).getCropType()], new Rectangle((int)(i * (input.getSpacingTile()) + input.getTileSize() - input.getTileSize() / 2.5), j * (input.getSpacingTile()), (int)(input.getTileSize() / 2.5), input.getTileSize() / 3), Color.White);
+ }
}
}
diff --git a/Game1/Sources/Controlls/Controller.cs b/Game1/Sources/Controlls/Controller.cs
index 08817cf..7f6cce5 100644
--- a/Game1/Sources/Controlls/Controller.cs
+++ b/Game1/Sources/Controlls/Controller.cs
@@ -59,7 +59,7 @@ class Controller
public int controllSpeed(int Speed)
{
KeyboardState state = Keyboard.GetState();
- if (state.IsKeyDown(Keys.Right))
+ if (state.IsKeyDown(Keys.Right) && Speed < 350)
{
Speed++;
}
diff --git a/Game1/Sources/Crops/Crops.cs b/Game1/Sources/Crops/Crops.cs
index 6230d6e..04e14b2 100644
--- a/Game1/Sources/Crops/Crops.cs
+++ b/Game1/Sources/Crops/Crops.cs
@@ -13,21 +13,34 @@ class Crops
private int originalStatus;
private int cropType = 0;
private int Timer = 1;
+ private int UpdateCrop;
private int fullTimer;
private bool housePos = false;
private Vector2 Size;
+ private CropTypes DataSet;
SoilProperties soilProperties = new SoilProperties();
public void updateCrop(Vector2 newSize)
{
-
- if (Status == 4 && Timer != 1)
+ if (Status == 3 && Timer != 1)
{
Timer--;
}
Size = newSize;
+ UpdateCrop++;
+ if (UpdateCrop == 60)
+ {
+ degradeSoil();
+ UpdateCrop = 0;
+ }
+
+ }
+
+ public SoilProperties getSoilProperties()
+ {
+ return soilProperties;
}
public int getCropTimer()
@@ -47,8 +60,6 @@ class Crops
soilProperties.setSoilProperties();
}
-
-
// Changes the time required for the crops to be harvestable
public void setCropTimer()
{
@@ -84,7 +95,7 @@ class Crops
{
return 8;
}
- else if (Status == 3) //crops
+ else
{
if (cropType == 0)
{
@@ -103,36 +114,36 @@ class Crops
return 50; //Fruit Trees
}
}
- else //Harvestable Crops
+ }
+
+ public void degradeSoil()
+ {
+
+ if (soilProperties.Nitrogen > 4.0f)
{
- if (cropType == 0)
- {
- return 30; //Carrots
- }
- else if (cropType == 1)
- {
- return 40; //Wheat
- }
- else if (cropType == 2)
- {
- return 50; //Berries
- }
- else
- {
- return 100; //Fruit Trees
- }
+ soilProperties.Nitrogen = soilProperties.Nitrogen - soilProperties.NitrogenDegradeRate;
}
+ if (soilProperties.Phosphorous > 0.1f)
+ {
+ soilProperties.Phosphorous = soilProperties.Phosphorous - soilProperties.PhosphorousDegradeRate;
+ }
+ if (soilProperties.Potassium > 0.1f)
+ {
+ soilProperties.Potassium = soilProperties.Potassium - soilProperties.PotassiumDegradeRate;
+ }
+
}
- public void setCropType(int Type)
+ public void setCropType(int Type, CropTypes nCropType)
{
+ DataSet = nCropType;
cropType = Type;
}
public int getStatus()
{
- if (Status != 4)
+ if (Status != 3)
{
return Status;
}
@@ -176,6 +187,47 @@ class Crops
return housePos;
}
+ public float getProductionRate()
+ {
+ if (DataSet != null)
+ {
+ int ProductionRate = 100;
+ ProductionRate = (int)(ProductionRate * compareToDatset(soilProperties.Temperature, DataSet.Temparature));
+ ProductionRate = (int)(ProductionRate * compareToDatset(soilProperties.Moisture , DataSet.Moisture));
+ ProductionRate = (int)(ProductionRate * compareToDatset(soilProperties.Humidity , DataSet.Humidity));
+ ProductionRate = (int)(ProductionRate * compareToDatset(soilProperties.Phosphorous , DataSet.Phosphorous));
+ ProductionRate = (int)(ProductionRate * compareToDatset(soilProperties.Potassium , DataSet.Potassium));
+ ProductionRate = (int)(ProductionRate * compareToDatset(soilProperties.Nitrogen , DataSet.Nitrogen));
+ if (ProductionRate < 0)
+ {
+ return 0;
+ }
+ else
+ {
+ return ProductionRate;
+ }
+
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ public float compareToDatset(float i, float j)
+ {
+ if (i < j)
+ {
+ return (i / j) * 0.2f;
+ }
+ else
+ {
+ return i / j;
+ }
+
+ }
+
+
public void Inspect(int tileSize, int Spacing, SpriteFont Bold, SpriteBatch spriteBatch, string[] cropTypesNames)
{
spriteBatch.Begin();
@@ -196,17 +248,13 @@ class Crops
spriteBatch.DrawString(Bold, "Tiletype: Soil", new Vector2(240, Size.Y * (tileSize + Spacing) + 42), Color.DarkBlue);
}
else if (Status == 3)
- {
- spriteBatch.DrawString(Bold, "Tiletype: Planted", new Vector2(240, Size.Y * (tileSize + Spacing) + 42), Color.DarkBlue);
- }
- else if (Status == 4)
{
int x = (int)(((float)Timer / fullTimer) * 100);
x = 100 - x;
spriteBatch.DrawString(Bold, "Tiletype: Crop ", new Vector2(240, Size.Y * (tileSize + Spacing) + 42), Color.DarkBlue);
spriteBatch.DrawString(Bold, "Completion: " + x + "%", new Vector2(240, Size.Y * (tileSize + Spacing) + 82), Color.DarkBlue);
}
- if (Status != 4)
+ if (Status != 3)
{
spriteBatch.DrawString(Bold, "-------------", new Vector2(240, Size.Y * (tileSize + Spacing) + 82), Color.DarkRed);
}
@@ -219,13 +267,22 @@ class Crops
spriteBatch.DrawString(Bold, "None", new Vector2(240, Size.Y * (tileSize + Spacing) + 62), Color.DarkBlue);
}
spriteBatch.DrawString(Bold, "Soil Properties:", new Vector2(240, Size.Y * (tileSize + Spacing) + 122), Color.DarkRed);
- spriteBatch.DrawString(Bold, "Soil Type: " + soilProperties.soilType, new Vector2(240, Size.Y * (tileSize + Spacing) + 142), Color.DarkBlue);
- spriteBatch.DrawString(Bold, "Temparature: " + soilProperties.Temparature, new Vector2(240, Size.Y * (tileSize + Spacing) + 162), Color.DarkBlue);
- spriteBatch.DrawString(Bold, "Moisture: " + soilProperties.Moisture, new Vector2(240, Size.Y * (tileSize + Spacing) + 182), Color.DarkBlue);
- spriteBatch.DrawString(Bold, "Humidity: " + soilProperties.Humidity, new Vector2(240, Size.Y * (tileSize + Spacing) + 202), Color.DarkBlue);
- spriteBatch.DrawString(Bold, "Phosphorous: " + soilProperties.Phosphorous, new Vector2(240, Size.Y * (tileSize + Spacing) + 222), Color.DarkBlue);
- spriteBatch.DrawString(Bold, "Potassium: " + soilProperties.Potassium, new Vector2(240, Size.Y * (tileSize + Spacing) + 242), Color.DarkBlue);
- spriteBatch.DrawString(Bold, "Nitrogen: " + soilProperties.Nitrogen, new Vector2(240, Size.Y * (tileSize + Spacing) + 262), Color.DarkBlue);
+ spriteBatch.DrawString(Bold, "Soil Type: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 142), Color.DarkRed);
+ spriteBatch.DrawString(Bold, soilProperties.soilType, new Vector2(370, Size.Y * (tileSize + Spacing) + 142), Color.DarkBlue);
+ spriteBatch.DrawString(Bold, "Temparature: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 162), Color.DarkRed);
+ spriteBatch.DrawString(Bold, soilProperties.Temperature.ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 162), Color.DarkBlue);
+ spriteBatch.DrawString(Bold, "Moisture: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 182), Color.DarkRed);
+ spriteBatch.DrawString(Bold, soilProperties.Moisture.ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 182), Color.DarkBlue);
+ spriteBatch.DrawString(Bold, "Humidity: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 202), Color.DarkRed);
+ spriteBatch.DrawString(Bold, soilProperties.Humidity.ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 202), Color.DarkBlue);
+ spriteBatch.DrawString(Bold, "Phosphorous: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 222), Color.DarkRed);
+ spriteBatch.DrawString(Bold, soilProperties.Phosphorous.ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 222), Color.DarkBlue);
+ spriteBatch.DrawString(Bold, "Potassium: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 242), Color.DarkRed);
+ spriteBatch.DrawString(Bold, soilProperties.Potassium.ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 242), Color.DarkBlue);
+ spriteBatch.DrawString(Bold, "Nitrogen: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 262), Color.DarkRed);
+ spriteBatch.DrawString(Bold, soilProperties.Nitrogen.ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 262), Color.DarkBlue);
+ spriteBatch.DrawString(Bold, "Production Rate: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 282), Color.DarkRed);
+ spriteBatch.DrawString(Bold, getProductionRate().ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 282), Color.DarkBlue);
spriteBatch.End();
}
}
diff --git a/Game1/Sources/Crops/Farm.cs b/Game1/Sources/Crops/Farm.cs
index ed4b416..09d2d6d 100644
--- a/Game1/Sources/Crops/Farm.cs
+++ b/Game1/Sources/Crops/Farm.cs
@@ -35,7 +35,8 @@ class Farm
crops[i, j] = new Crops();
crops[i, j].setStatus(x);
crops[i, j].setOriginalStatus();
- crops[i, j].setCropType(x = r.Next(0, 4));
+ x = r.Next(0, 11);
+ crops[i, j].setCropType(x, PresetCrops.getPresetCropTypes(x));
crops[i, j].init();
}
}
@@ -58,7 +59,7 @@ class Farm
{
int x = (int)xfloat;
int y = (int)yfloat;
- if (crops[x, y].getStatus() >= 4)
+ if (crops[x, y].getStatus() >= 3)
{
crops[x, y].setStatus(2);
}
@@ -69,10 +70,6 @@ class Farm
else if (crops[x, y].getStatus() == 2)
{
crops[x, y].setStatus(3);
- }
- else if (crops[x, y].getStatus() == 3)
- {
- crops[x, y].setStatus(4);
crops[x, y].setCropTimer();
}
}
diff --git a/Game1/Sources/Crops/SoilProperties.cs b/Game1/Sources/Crops/SoilProperties.cs
index 1149557..6b241e7 100644
--- a/Game1/Sources/Crops/SoilProperties.cs
+++ b/Game1/Sources/Crops/SoilProperties.cs
@@ -11,12 +11,15 @@ class SoilProperties
public string soilType = "potato";
- public float Temparature;
+ public float Temperature;
public float Humidity;
public float Moisture;
public float Nitrogen;
public float Potassium;
public float Phosphorous;
+ public float NitrogenDegradeRate = 0.001f;
+ public float PotassiumDegradeRate = 0.001f;
+ public float PhosphorousDegradeRate = 0.001f;
public void setSoilProperties()
{
@@ -41,8 +44,8 @@ class SoilProperties
{
soilType = "Clayey";
}
- Temparature = GetRandomNumber(22, 30);
- Humidity = Temparature * 2 + GetRandomNumber(1.9, 2.2);
+ Temperature = GetRandomNumber(22, 30);
+ Humidity = Temperature * GetRandomNumber(1.9, 2.1);
Moisture = GetRandomNumber(20, 70);
Nitrogen = GetRandomNumber(4 , 55);
Potassium = GetRandomNumber(0, 28);
diff --git a/Game1/Sources/Objects/DayNightCycle.cs b/Game1/Sources/Objects/DayNightCycle.cs
index e111ea1..2efaa29 100644
--- a/Game1/Sources/Objects/DayNightCycle.cs
+++ b/Game1/Sources/Objects/DayNightCycle.cs
@@ -12,7 +12,7 @@ class DayNightCycle
private int dayTime = 0;
private int lengthOfDay = 20000;
private int lengthOfNight = 20000;
- private int Days;
+ private int Days = 1;
public void updateTime(int Speed)
{
From 095ccc0fc6611fbf91a592ef962a9d0c9703b657 Mon Sep 17 00:00:00 2001
From: Joel
Date: Thu, 7 May 2020 13:53:07 +0200
Subject: [PATCH 07/15] Production System fixed
---
Game1/Sources/Crops/CropTypesHolder.cs | 2 +-
Game1/Sources/Crops/Crops.cs | 57 +++++++++++++-------------
Game1/Sources/Crops/Farm.cs | 13 ++++--
Game1/Sources/Crops/SoilProperties.cs | 4 +-
4 files changed, 42 insertions(+), 34 deletions(-)
diff --git a/Game1/Sources/Crops/CropTypesHolder.cs b/Game1/Sources/Crops/CropTypesHolder.cs
index 1b09922..f63e48b 100644
--- a/Game1/Sources/Crops/CropTypesHolder.cs
+++ b/Game1/Sources/Crops/CropTypesHolder.cs
@@ -75,7 +75,7 @@ class CropTypesHolder
cropTypes[4].Humidity = 57.3f;
cropTypes[4].Moisture = 38.5f;
cropTypes[4].Nitrogen = 23.2f;
- cropTypes[4].Potassium = 0;
+ cropTypes[4].Potassium = 0.1f;
cropTypes[4].Phosphorous = 14.4f;
//Oil Seeds
diff --git a/Game1/Sources/Crops/Crops.cs b/Game1/Sources/Crops/Crops.cs
index 04e14b2..357864c 100644
--- a/Game1/Sources/Crops/Crops.cs
+++ b/Game1/Sources/Crops/Crops.cs
@@ -12,21 +12,23 @@ class Crops
private int Status;
private int originalStatus;
private int cropType = 0;
- private int Timer = 1;
+ private float Timer = 1;
private int UpdateCrop;
- private int fullTimer;
+ private float fullTimer;
private bool housePos = false;
private Vector2 Size;
private CropTypes DataSet;
SoilProperties soilProperties = new SoilProperties();
+ private float ProductionRate = 0;
public void updateCrop(Vector2 newSize)
{
+ getProductionRate();
if (Status == 3 && Timer != 1)
{
- Timer--;
+ Timer = Timer - 1 * ProductionRate;
}
Size = newSize;
UpdateCrop++;
@@ -35,6 +37,10 @@ class Crops
degradeSoil();
UpdateCrop = 0;
}
+ if (Timer < 1)
+ {
+ Timer = 1;
+ }
}
@@ -43,7 +49,7 @@ class Crops
return soilProperties;
}
- public int getCropTimer()
+ public float getCropTimer()
{
return Timer;
}
@@ -187,38 +193,33 @@ class Crops
return housePos;
}
- public float getProductionRate()
+ public void getProductionRate()
{
+ ProductionRate = 1;
if (DataSet != null)
{
- int ProductionRate = 100;
- ProductionRate = (int)(ProductionRate * compareToDatset(soilProperties.Temperature, DataSet.Temparature));
- ProductionRate = (int)(ProductionRate * compareToDatset(soilProperties.Moisture , DataSet.Moisture));
- ProductionRate = (int)(ProductionRate * compareToDatset(soilProperties.Humidity , DataSet.Humidity));
- ProductionRate = (int)(ProductionRate * compareToDatset(soilProperties.Phosphorous , DataSet.Phosphorous));
- ProductionRate = (int)(ProductionRate * compareToDatset(soilProperties.Potassium , DataSet.Potassium));
- ProductionRate = (int)(ProductionRate * compareToDatset(soilProperties.Nitrogen , DataSet.Nitrogen));
+ ProductionRate = (ProductionRate * compareToDatset(soilProperties.Temperature, DataSet.Temparature));
+ ProductionRate = (ProductionRate * compareToDatset(soilProperties.Moisture, DataSet.Moisture));
+ ProductionRate = (ProductionRate * compareToDatset(soilProperties.Humidity, DataSet.Humidity));
+ ProductionRate = (ProductionRate * compareToDatset(soilProperties.Phosphorous, DataSet.Phosphorous));
+ ProductionRate = (ProductionRate * compareToDatset(soilProperties.Potassium, DataSet.Potassium));
+ ProductionRate = (ProductionRate * compareToDatset(soilProperties.Nitrogen, DataSet.Nitrogen));
if (ProductionRate < 0)
{
- return 0;
+ ProductionRate = 0;
}
- else
- {
- return ProductionRate;
- }
-
- }
- else
- {
- return 0;
}
}
public float compareToDatset(float i, float j)
{
- if (i < j)
+ if (i > j)
{
- return (i / j) * 0.2f;
+ return (i / j) * 0.15f;
+ }
+ else if (i < j / 2)
+ {
+ return (i / j) * 2f;
}
else
{
@@ -276,13 +277,13 @@ class Crops
spriteBatch.DrawString(Bold, "Humidity: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 202), Color.DarkRed);
spriteBatch.DrawString(Bold, soilProperties.Humidity.ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 202), Color.DarkBlue);
spriteBatch.DrawString(Bold, "Phosphorous: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 222), Color.DarkRed);
- spriteBatch.DrawString(Bold, soilProperties.Phosphorous.ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 222), Color.DarkBlue);
+ spriteBatch.DrawString(Bold, Math.Round(soilProperties.Phosphorous,1).ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 222), Color.DarkBlue);
spriteBatch.DrawString(Bold, "Potassium: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 242), Color.DarkRed);
- spriteBatch.DrawString(Bold, soilProperties.Potassium.ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 242), Color.DarkBlue);
+ spriteBatch.DrawString(Bold, Math.Round(soilProperties.Potassium, 1).ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 242), Color.DarkBlue);
spriteBatch.DrawString(Bold, "Nitrogen: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 262), Color.DarkRed);
- spriteBatch.DrawString(Bold, soilProperties.Nitrogen.ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 262), Color.DarkBlue);
+ spriteBatch.DrawString(Bold, Math.Round(soilProperties.Nitrogen, 1).ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 262), Color.DarkBlue);
spriteBatch.DrawString(Bold, "Production Rate: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 282), Color.DarkRed);
- spriteBatch.DrawString(Bold, getProductionRate().ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 282), Color.DarkBlue);
+ spriteBatch.DrawString(Bold, Math.Round((ProductionRate * 100), 1).ToString() + "%", new Vector2(370, Size.Y * (tileSize + Spacing) + 282), Color.DarkBlue);
spriteBatch.End();
}
}
diff --git a/Game1/Sources/Crops/Farm.cs b/Game1/Sources/Crops/Farm.cs
index 09d2d6d..17997d4 100644
--- a/Game1/Sources/Crops/Farm.cs
+++ b/Game1/Sources/Crops/Farm.cs
@@ -11,6 +11,7 @@ class Farm
private Crops[,] crops;
private Random r;
private CropTypesHolder PresetCrops = new CropTypesHolder();
+ private int Update;
//initializes the crops
@@ -44,14 +45,20 @@ class Farm
public void updateFarm(Vector2 Size)
{
- for (int i = 0; i < Size.X; i++)
+ Update++;
+ if (Update == 30)
{
- for (int j = 0; j < Size.Y; j++)
+ for (int i = 0; i < Size.X; i++)
{
+ for (int j = 0; j < Size.Y; j++)
+ {
- crops[i, j].updateCrop(Size);
+ crops[i, j].updateCrop(Size);
+ }
}
+ Update = 0;
}
+
}
//Changes the properties of the tile when the tractor reaches this tile.
diff --git a/Game1/Sources/Crops/SoilProperties.cs b/Game1/Sources/Crops/SoilProperties.cs
index 6b241e7..bf3e3b7 100644
--- a/Game1/Sources/Crops/SoilProperties.cs
+++ b/Game1/Sources/Crops/SoilProperties.cs
@@ -48,8 +48,8 @@ class SoilProperties
Humidity = Temperature * GetRandomNumber(1.9, 2.1);
Moisture = GetRandomNumber(20, 70);
Nitrogen = GetRandomNumber(4 , 55);
- Potassium = GetRandomNumber(0, 28);
- Phosphorous = GetRandomNumber(0, 60);
+ Potassium = GetRandomNumber(0.01f, 28);
+ Phosphorous = GetRandomNumber(0.01f, 60);
}
public float GetRandomNumber(double minimum, double maximum)
From 4ab4abaa89c82f535de44d5676febad20e17d042 Mon Sep 17 00:00:00 2001
From: Joel
Date: Thu, 7 May 2020 14:51:52 +0200
Subject: [PATCH 08/15] Last Images and at last fixed the Production System
---
Game1/Content/BarleyIcon.png | Bin 0 -> 2177 bytes
Game1/Content/Content.mgcb | 36 ++++++++++++++++++++++++++
Game1/Content/CottonIcon.png | Bin 0 -> 3613 bytes
Game1/Content/GroundNutsIcon.png | Bin 0 -> 1612 bytes
Game1/Game1.cs | 8 +++---
Game1/Sources/Crops/Crops.cs | 26 +++++++++----------
Game1/Sources/Crops/SoilProperties.cs | 6 ++---
7 files changed, 56 insertions(+), 20 deletions(-)
create mode 100644 Game1/Content/BarleyIcon.png
create mode 100644 Game1/Content/CottonIcon.png
create mode 100644 Game1/Content/GroundNutsIcon.png
diff --git a/Game1/Content/BarleyIcon.png b/Game1/Content/BarleyIcon.png
new file mode 100644
index 0000000000000000000000000000000000000000..1c7b5af7595e73cf45d51abb5cc46ee8eabb726f
GIT binary patch
literal 2177
zcmV-{2!8j8P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGmbN~PnbOGLGA9w%&2o_01K~#8N?VQbv
z97Pz$Yj!^NBiY>;*MN#BiU$=vcrXarORg&DL60Jc2MKr(h1~S!e~^IWpn?}YiTV#D
zdoV%{#y~*uB50z-B%96d%ZH+t6p|oxFiwC6v@7s8fvE3u5S%2}xT#nIUD^O8U
zN)g0H2+;*Ae}BluAoBEhu?$?l^T2zo+5d<2mS5w?MBp&hIo)v^aq;x~Uit
zLJmoLOQ+-1n7yS_acT_43p6;k&i1AFXp(;W={PmM9t|tHNJKsdA>caQHB@K0-YQ&-
znS~vaRSA;^L8C9-`JAy~kL@qK%yy2y8=qlp_2wDY7;N#h&OJx&oMY{spS1U)-alxa
zm~sJyK$ChBS+22liZh3}5CcGr#^4@njP_WkdoeybX3%;fPAS|I_wGUKvG|A@>isGg
zKpYz}Kvw=DPRZ?%w4161XI+d2t2f@C%$mTc8I?U6veDdvc934&{5mT07dAJzIcXr>
zJ<{$?nB-BB<`z?@6n02f55NGsxcOzgH%9E8)U%1*qp!rNG2AV~`^s{N=Kfy^F#z2|
zE?>O24pknx92IG9$>Wq<4$P~Y%0rlZ|s@9?yYE^aSu{V={BHHxb;=sd}`
z9{O~=qd?WOsr>EZXQs~CpsS|}ol{I)BDTG?AUZMRO6x*^?zjq*21(0f)1W%U`exNV
zuPB8>mW=9wQE@be2p(vD`{LAb8RSD_;=!{TbI^I5_2-{SOo>gdM;^@1kdMG@@93@1
z5@m_cL1`*qrik!_l^`}TQEm(pqqX~MX2n%v>R7yeAu98FVyrQ_9(gcTrhI(r{qMP{
zvc%`0v`zhhO}klzELFj#y@JAr9M>U~xSxiYm(ufF-|^`(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$V5d`s!Ac$uK
zK|CV};u%2@&j^BeM&f%&pg!n($V8BUAB2$Q6^#7{ybyG4WYXGn00000NkvXXu0mjf
D+t3C$
literal 0
HcmV?d00001
diff --git a/Game1/Content/Content.mgcb b/Game1/Content/Content.mgcb
index c286d3c..2a9708d 100644
--- a/Game1/Content/Content.mgcb
+++ b/Game1/Content/Content.mgcb
@@ -13,6 +13,18 @@
#---------------------------------- Content ---------------------------------#
+#begin BarleyIcon.png
+/importer:TextureImporter
+/processor:TextureProcessor
+/processorParam:ColorKeyColor=255,0,255,255
+/processorParam:ColorKeyEnabled=True
+/processorParam:GenerateMipmaps=False
+/processorParam:PremultiplyAlpha=True
+/processorParam:ResizeToPowerOfTwo=False
+/processorParam:MakeSquare=False
+/processorParam:TextureFormat=Color
+/build:BarleyIcon.png
+
#begin BerriesIcon.png
/importer:TextureImporter
/processor:TextureProcessor
@@ -37,6 +49,18 @@
/processorParam:TextureFormat=Color
/build:CarronIcon.png;CarrotIcon.png
+#begin CottonIcon.png
+/importer:TextureImporter
+/processor:TextureProcessor
+/processorParam:ColorKeyColor=255,0,255,255
+/processorParam:ColorKeyEnabled=True
+/processorParam:GenerateMipmaps=False
+/processorParam:PremultiplyAlpha=True
+/processorParam:ResizeToPowerOfTwo=False
+/processorParam:MakeSquare=False
+/processorParam:TextureFormat=Color
+/build:CottonIcon.png
+
#begin Crop.png
/importer:TextureImporter
/processor:TextureProcessor
@@ -56,6 +80,18 @@
/processorParam:TextureFormat=Compressed
/build:Font.spritefont
+#begin GroundNutsIcon.png
+/importer:TextureImporter
+/processor:TextureProcessor
+/processorParam:ColorKeyColor=255,0,255,255
+/processorParam:ColorKeyEnabled=True
+/processorParam:GenerateMipmaps=False
+/processorParam:PremultiplyAlpha=True
+/processorParam:ResizeToPowerOfTwo=False
+/processorParam:MakeSquare=False
+/processorParam:TextureFormat=Color
+/build:GroundNutsIcon.png
+
#begin house.png
/importer:TextureImporter
/processor:TextureProcessor
diff --git a/Game1/Content/CottonIc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z`nH2U$ms=269kh*A*(Ss2#TqgYIJOk=W`PfxhyLwLa-pdmISqqVp<$n85jef@G;fs
z*cy+82)^I!G{J(%nK{z}Gc<)`X7CX3WAH7lNvZJ{U;DS-3cChYSmYZ*AHjmie*lAd
zXDLe7EX?!Ky228FAF%;n)@Zc2I4L!L;=HMPtHIQ7%+p(D%5GRlqGAYlM<{%V#Pi^`
zFyAg$qU_(lUoBm_G)N?0TzUJq*Q`K(pAMuINzo*7j=OJspR@MUqKuH=PO+jWLAX0Y
z;rI9V2f3)MbC@sf_pMTK{m&`l?2ci*)hHARtmJ<$TwC}C(Odq^1*Kc@)(!Zsipod?l;1p`skyR74zS&8i$Ss|owsY^(S
z=qph8nDuw8@Sc3D9#ZULeNL7_?4
z1yO3XTE1orRz%{21b2wxb5jymfe@wu?-Hf0ATxupU6X1BA#1YYZ7M@96a$D45C-Ei
zlw8Y9Ap}H=6$6A8h&<0G9>E2~!ZzDAQaqpa5g`i!lLP?}C3d)*{z#l_S5VrT>3L;28g}4fq5)_W`3)5LxSegcPjFN^l=)*@Xu6Q7K3)
zAq8u*667PGhknpHY6ani7eYwEaw|z)$T#Ymy#zIXQR8Dj$1WRQ_M=viUcxHK7~P{y
jkTH6Lu~t@3q168Y(pYSWZ7ca&00000NkvXXu0mjfkkz;@
literal 0
HcmV?d00001
diff --git a/Game1/Content/GroundNutsIcon.png b/Game1/Content/GroundNutsIcon.png
new file mode 100644
index 0000000000000000000000000000000000000000..de2cf45481d4a35df73dcbaaa2a6a3a2679f146f
GIT binary patch
literal 1612
zcmb`I`#aMM0LH&tF5j8CRgTGG5`~;NB}*>*noI}PY)T0+=IJ4_W)gEPPmSD&VgV=#AwCM2ZnGCX!_tmpen{NPFKOT
z+`aFDClM~mI%m4Yo}FQCaS$=?V_1DDoNo{+Z;clv&d9n%!>4I9aj;n5fys=|bEUKB
zBAI9?mP~ngq*WIyOPoDpFsM5){D@GLcL^n!%jx#!+wYPG)#Mz7{wv4Vf91BDyOK*&
zrx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=T|5(V5Zg%&NagFS2`2xGkgXxxZu1ucNnTn(HH7_?9Wec0tm{5k
SQPNi)0Pyt=APAxGtbYMe|JmaJ
literal 0
HcmV?d00001
diff --git a/Game1/Game1.cs b/Game1/Game1.cs
index a1372d0..0fb937c 100644
--- a/Game1/Game1.cs
+++ b/Game1/Game1.cs
@@ -97,12 +97,14 @@ namespace Game1
tile[2] = Content.Load("Plantable");
tile[3] = Content.Load("Crop");
- Crops[0] = Content.Load("CarrotIcon");
- Crops[1] = Content.Load("WheatIcon");
- Crops[2] = Content.Load("BerriesIcon");
+
+
+ Crops[0] = Content.Load("BarleyIcon");
+ Crops[1] = Content.Load("CottonIcon");
+ Crops[2] = Content.Load("GroundNutsIcon");
Crops[3] = Content.Load("MaizeIcon");
Crops[4] = Content.Load("MilletsIcon");
Crops[5] = Content.Load("SeedOilIcon");
diff --git a/Game1/Sources/Crops/Crops.cs b/Game1/Sources/Crops/Crops.cs
index 357864c..9e060c1 100644
--- a/Game1/Sources/Crops/Crops.cs
+++ b/Game1/Sources/Crops/Crops.cs
@@ -28,7 +28,7 @@ class Crops
getProductionRate();
if (Status == 3 && Timer != 1)
{
- Timer = Timer - 1 * ProductionRate;
+ Timer = Timer - 1f * ProductionRate;
}
Size = newSize;
UpdateCrop++;
@@ -198,33 +198,31 @@ class Crops
ProductionRate = 1;
if (DataSet != null)
{
- ProductionRate = (ProductionRate * compareToDatset(soilProperties.Temperature, DataSet.Temparature));
- ProductionRate = (ProductionRate * compareToDatset(soilProperties.Moisture, DataSet.Moisture));
- ProductionRate = (ProductionRate * compareToDatset(soilProperties.Humidity, DataSet.Humidity));
- ProductionRate = (ProductionRate * compareToDatset(soilProperties.Phosphorous, DataSet.Phosphorous));
- ProductionRate = (ProductionRate * compareToDatset(soilProperties.Potassium, DataSet.Potassium));
- ProductionRate = (ProductionRate * compareToDatset(soilProperties.Nitrogen, DataSet.Nitrogen));
+ ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Temperature, DataSet.Temparature));
+ ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Moisture, DataSet.Moisture));
+ ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Humidity, DataSet.Humidity));
+ ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Phosphorous, DataSet.Phosphorous));
+ ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Potassium, DataSet.Potassium));
+ ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Nitrogen, DataSet.Nitrogen));
if (ProductionRate < 0)
{
ProductionRate = 0;
}
+ ProductionRate = ProductionRate / 20;
}
}
public float compareToDatset(float i, float j)
{
- if (i > j)
+ if (i < j)
{
- return (i / j) * 0.15f;
- }
- else if (i < j / 2)
- {
- return (i / j) * 2f;
+ return (i / j);
}
else
{
- return i / j;
+ return (j / i);
}
+
}
diff --git a/Game1/Sources/Crops/SoilProperties.cs b/Game1/Sources/Crops/SoilProperties.cs
index bf3e3b7..c8dcffe 100644
--- a/Game1/Sources/Crops/SoilProperties.cs
+++ b/Game1/Sources/Crops/SoilProperties.cs
@@ -17,9 +17,9 @@ class SoilProperties
public float Nitrogen;
public float Potassium;
public float Phosphorous;
- public float NitrogenDegradeRate = 0.001f;
- public float PotassiumDegradeRate = 0.001f;
- public float PhosphorousDegradeRate = 0.001f;
+ public float NitrogenDegradeRate = 0.01f;
+ public float PotassiumDegradeRate = 0.01f;
+ public float PhosphorousDegradeRate = 0.01f;
public void setSoilProperties()
{
From a54a7f914cf752cfaa01fc563c6b889b43de0c32 Mon Sep 17 00:00:00 2001
From: Joel
Date: Thu, 7 May 2020 20:06:34 +0200
Subject: [PATCH 09/15] implemented getHighestProductionRate(x, y) per tile
---
Game1/Game1.cs | 49 +++---
Game1/Sources/Crops/CropTypesHolder.cs | 232 +++++++++++++------------
Game1/Sources/Crops/Crops.cs | 18 +-
Game1/Sources/Crops/Farm.cs | 28 ++-
4 files changed, 183 insertions(+), 144 deletions(-)
diff --git a/Game1/Game1.cs b/Game1/Game1.cs
index 0fb937c..b6ccf57 100644
--- a/Game1/Game1.cs
+++ b/Game1/Game1.cs
@@ -14,7 +14,7 @@ namespace Game1
SpriteBatch spriteBatch;
SpriteFont Bold;
private Texture2D[] tile = new Texture2D[5];
- private Texture2D[] Crops = new Texture2D[11];
+ private Texture2D[] Crops = new Texture2D[12];
private Texture2D tractor;
private Texture2D house;
private Texture2D markers;
@@ -50,17 +50,18 @@ namespace Game1
// TODO: Add your initialization logic here
base.Initialize();
- cropTypesNames[0] = "Barley";
- cropTypesNames[1] = "Cotton";
- cropTypesNames[2] = "Ground Nuts";
- cropTypesNames[3] = "Maize";
- cropTypesNames[4] = "Millets";
- cropTypesNames[5] = "Oil Seeds";
- cropTypesNames[6] = "Paddy";
- cropTypesNames[7] = "Pulses";
- cropTypesNames[8] = "Sugarcane";
- cropTypesNames[9] = "Tobacco";
- cropTypesNames[10] = "Wheat";
+ cropTypesNames[0] = "None";
+ cropTypesNames[1] = "Barley";
+ cropTypesNames[2] = "Cotton";
+ cropTypesNames[3] = "Ground Nuts";
+ cropTypesNames[4] = "Maize";
+ cropTypesNames[5] = "Millets";
+ cropTypesNames[6] = "Oil Seeds";
+ cropTypesNames[7] = "Paddy";
+ cropTypesNames[8] = "Pulses";
+ cropTypesNames[9] = "Sugarcane";
+ cropTypesNames[10] = "Tobacco";
+ cropTypesNames[11] = "Wheat";
@@ -101,18 +102,18 @@ namespace Game1
-
- Crops[0] = Content.Load("BarleyIcon");
- Crops[1] = Content.Load("CottonIcon");
- Crops[2] = Content.Load("GroundNutsIcon");
- Crops[3] = Content.Load("MaizeIcon");
- Crops[4] = Content.Load("MilletsIcon");
- Crops[5] = Content.Load("SeedOilIcon");
- Crops[6] = Content.Load("PaddyIcon");
- Crops[7] = Content.Load("PulsesIcon");
- Crops[8] = Content.Load("SugarcaneIcon");
- Crops[9] = Content.Load("TobaccoIcon");
- Crops[10] = Content.Load("WheatIcon");
+ Crops[0] = Content.Load("Markers");
+ Crops[1] = Content.Load("BarleyIcon");
+ Crops[2] = Content.Load("CottonIcon");
+ Crops[3] = Content.Load("GroundNutsIcon");
+ Crops[4] = Content.Load("MaizeIcon");
+ Crops[5] = Content.Load("MilletsIcon");
+ Crops[6] = Content.Load("SeedOilIcon");
+ Crops[7] = Content.Load("PaddyIcon");
+ Crops[8] = Content.Load("PulsesIcon");
+ Crops[9] = Content.Load("SugarcaneIcon");
+ Crops[10] = Content.Load("TobaccoIcon");
+ Crops[11] = Content.Load("WheatIcon");
ProgressionBar = Content.Load("ProgressionBar");
diff --git a/Game1/Sources/Crops/CropTypesHolder.cs b/Game1/Sources/Crops/CropTypesHolder.cs
index f63e48b..e6fa27a 100644
--- a/Game1/Sources/Crops/CropTypesHolder.cs
+++ b/Game1/Sources/Crops/CropTypesHolder.cs
@@ -7,152 +7,164 @@ using System.Threading.Tasks;
class CropTypesHolder
{
- private CropTypes[] cropTypes = new CropTypes[11];
+ private CropTypes[] cropTypes = new CropTypes[12];
public void init()
{
- // Barley
+ // None
cropTypes[0] = new CropTypes();
- cropTypes[0].soilType[0] = "Sandy";
+ cropTypes[0].soilType[0] = "None";
cropTypes[0].soilType[1] = null;
cropTypes[0].soilType[2] = null;
- cropTypes[0].Temparature = 30.1f;
- cropTypes[0].Humidity = 59.0f;
- cropTypes[0].Moisture = 41.7f;
- cropTypes[0].Nitrogen = 12.6f;
- cropTypes[0].Potassium = 5.3f;
- cropTypes[0].Phosphorous = 26.0f;
+ cropTypes[0].Temparature = 0f;
+ cropTypes[0].Humidity = 0f;
+ cropTypes[0].Moisture = 0f;
+ cropTypes[0].Nitrogen = 0f;
+ cropTypes[0].Potassium = 0f;
+ cropTypes[0].Phosphorous = 0f;
+
+ // Barley
+ cropTypes[1] = new CropTypes();
+ cropTypes[1].soilType[0] = "Sandy";
+ cropTypes[1].soilType[1] = null;
+ cropTypes[1].soilType[2] = null;
+ cropTypes[1].Temparature = 30.1f;
+ cropTypes[1].Humidity = 59.0f;
+ cropTypes[1].Moisture = 41.7f;
+ cropTypes[1].Nitrogen = 12.6f;
+ cropTypes[1].Potassium = 5.3f;
+ cropTypes[1].Phosphorous = 26.0f;
// Cotton
- cropTypes[1] = new CropTypes();
- cropTypes[1].soilType[0] = "Red";
- cropTypes[1].Times[0] = 5;
- cropTypes[1].soilType[1] = "Black";
- cropTypes[1].Times[1] = 4;
- cropTypes[1].soilType[2] = "Loamy";
- cropTypes[1].Times[2] = 3;
- cropTypes[1].Temparature = 30.4f;
- cropTypes[1].Humidity = 59.6f;
- cropTypes[1].Moisture = 63.2f;
- cropTypes[1].Nitrogen = 16.4f;
- cropTypes[1].Potassium = 3.3f;
- cropTypes[1].Phosphorous = 23.8f;
-
- // Ground Nuts
cropTypes[2] = new CropTypes();
cropTypes[2].soilType[0] = "Red";
- cropTypes[2].soilType[1] = null;
- cropTypes[2].soilType[2] = null;
- cropTypes[2].Temparature = 30.1f;
- cropTypes[2].Humidity = 59.1f;
- cropTypes[2].Moisture = 33.1f;
- cropTypes[2].Nitrogen = 23.3f;
- cropTypes[2].Potassium = 2.0f;
- cropTypes[2].Phosphorous = 21.6f;
+ cropTypes[2].Times[0] = 5;
+ cropTypes[2].soilType[1] = "Black";
+ cropTypes[2].Times[1] = 4;
+ cropTypes[2].soilType[2] = "Loamy";
+ cropTypes[2].Times[2] = 3;
+ cropTypes[2].Temparature = 30.4f;
+ cropTypes[2].Humidity = 59.6f;
+ cropTypes[2].Moisture = 63.2f;
+ cropTypes[2].Nitrogen = 16.4f;
+ cropTypes[2].Potassium = 3.3f;
+ cropTypes[2].Phosphorous = 23.8f;
+
+ // Ground Nuts
+ cropTypes[3] = new CropTypes();
+ cropTypes[3].soilType[0] = "Red";
+ cropTypes[3].soilType[1] = null;
+ cropTypes[3].soilType[2] = null;
+ cropTypes[3].Temparature = 30.1f;
+ cropTypes[3].Humidity = 59.1f;
+ cropTypes[3].Moisture = 33.1f;
+ cropTypes[3].Nitrogen = 23.3f;
+ cropTypes[3].Potassium = 2.0f;
+ cropTypes[3].Phosphorous = 21.6f;
// Maize
- cropTypes[3] = new CropTypes();
- cropTypes[3].soilType[0] = "Sandy";
- cropTypes[3].soilType[1] = null;
- cropTypes[3].soilType[2] = null;
- cropTypes[3].Temparature = 29.0f;
- cropTypes[3].Humidity = 57.3f;
- cropTypes[3].Moisture = 42.2f;
- cropTypes[3].Nitrogen = 18.3f;
- cropTypes[3].Potassium = 5.7f;
- cropTypes[3].Phosphorous = 18.7f;
-
- // Millets
cropTypes[4] = new CropTypes();
cropTypes[4].soilType[0] = "Sandy";
- cropTypes[4].Times[0] = 7;
- cropTypes[4].soilType[1] = "Black";
- cropTypes[4].Times[0] = 4;
+ cropTypes[4].soilType[1] = null;
cropTypes[4].soilType[2] = null;
- cropTypes[4].Temparature = 29.5f;
+ cropTypes[4].Temparature = 29.0f;
cropTypes[4].Humidity = 57.3f;
- cropTypes[4].Moisture = 38.5f;
- cropTypes[4].Nitrogen = 23.2f;
- cropTypes[4].Potassium = 0.1f;
- cropTypes[4].Phosphorous = 14.4f;
+ cropTypes[4].Moisture = 42.2f;
+ cropTypes[4].Nitrogen = 18.3f;
+ cropTypes[4].Potassium = 5.7f;
+ cropTypes[4].Phosphorous = 18.7f;
+
+ // Millets
+ cropTypes[5] = new CropTypes();
+ cropTypes[5].soilType[0] = "Sandy";
+ cropTypes[5].Times[0] = 7;
+ cropTypes[5].soilType[1] = "Black";
+ cropTypes[5].Times[0] = 4;
+ cropTypes[5].soilType[2] = null;
+ cropTypes[5].Temparature = 29.5f;
+ cropTypes[5].Humidity = 57.3f;
+ cropTypes[5].Moisture = 38.5f;
+ cropTypes[5].Nitrogen = 23.2f;
+ cropTypes[5].Potassium = 0.1f;
+ cropTypes[5].Phosphorous = 14.4f;
//Oil Seeds
- cropTypes[5] = new CropTypes();
- cropTypes[5].soilType[0] = "Black";
- cropTypes[5].soilType[1] = null;
- cropTypes[5].soilType[2] = null;
- cropTypes[5].Temparature = 30.3f;
- cropTypes[5].Humidity = 59.1f;
- cropTypes[5].Moisture = 32.1f;
- cropTypes[5].Nitrogen = 19.0f;
- cropTypes[5].Potassium = 2.3f;
- cropTypes[5].Phosphorous = 17.3f;
-
- //Paddys
cropTypes[6] = new CropTypes();
- cropTypes[6].soilType[0] = "Clayey";
+ cropTypes[6].soilType[0] = "Black";
cropTypes[6].soilType[1] = null;
cropTypes[6].soilType[2] = null;
- cropTypes[6].Temparature = 31.2f;
- cropTypes[6].Humidity = 60.4f;
- cropTypes[6].Moisture = 41.5f;
- cropTypes[6].Nitrogen = 20.8f;
- cropTypes[6].Potassium = 3.7f;
- cropTypes[6].Phosphorous = 16.3f;
+ cropTypes[6].Temparature = 30.3f;
+ cropTypes[6].Humidity = 59.1f;
+ cropTypes[6].Moisture = 32.1f;
+ cropTypes[6].Nitrogen = 19.0f;
+ cropTypes[6].Potassium = 2.3f;
+ cropTypes[6].Phosphorous = 17.3f;
- //Pulses
+ //Paddys
cropTypes[7] = new CropTypes();
cropTypes[7].soilType[0] = "Clayey";
cropTypes[7].soilType[1] = null;
cropTypes[7].soilType[2] = null;
- cropTypes[7].Temparature = 27.8f;
- cropTypes[7].Humidity = 54.9f;
- cropTypes[7].Moisture = 34.1f;
- cropTypes[7].Nitrogen = 18.4f;
- cropTypes[7].Potassium = 4.2f;
- cropTypes[7].Phosphorous = 17.5f;
+ cropTypes[7].Temparature = 31.2f;
+ cropTypes[7].Humidity = 60.4f;
+ cropTypes[7].Moisture = 41.5f;
+ cropTypes[7].Nitrogen = 20.8f;
+ cropTypes[7].Potassium = 3.7f;
+ cropTypes[7].Phosphorous = 16.3f;
+
+ //Pulses
+ cropTypes[8] = new CropTypes();
+ cropTypes[8].soilType[0] = "Clayey";
+ cropTypes[8].soilType[1] = null;
+ cropTypes[8].soilType[2] = null;
+ cropTypes[8].Temparature = 27.8f;
+ cropTypes[8].Humidity = 54.9f;
+ cropTypes[8].Moisture = 34.1f;
+ cropTypes[8].Nitrogen = 18.4f;
+ cropTypes[8].Potassium = 4.2f;
+ cropTypes[8].Phosphorous = 17.5f;
//Sugarcane
- cropTypes[8] = new CropTypes();
- cropTypes[8].soilType[0] = "Loamy";
- cropTypes[8].Times[0] = 9;
- cropTypes[8].soilType[1] = "Black";
- cropTypes[8].Times[0] = 4;
- cropTypes[8].soilType[2] = null;
- cropTypes[8].Temparature = 30.0f;
- cropTypes[8].Humidity = 58.6f;
- cropTypes[8].Moisture = 51.2f;
- cropTypes[8].Nitrogen = 14.6f;
- cropTypes[8].Potassium = 4.2f;
- cropTypes[8].Phosphorous = 17.6f;
+ cropTypes[9] = new CropTypes();
+ cropTypes[9].soilType[0] = "Loamy";
+ cropTypes[9].Times[0] = 9;
+ cropTypes[9].soilType[1] = "Black";
+ cropTypes[9].Times[0] = 4;
+ cropTypes[9].soilType[2] = null;
+ cropTypes[9].Temparature = 30.0f;
+ cropTypes[9].Humidity = 58.6f;
+ cropTypes[9].Moisture = 51.2f;
+ cropTypes[9].Nitrogen = 14.6f;
+ cropTypes[9].Potassium = 4.2f;
+ cropTypes[9].Phosphorous = 17.6f;
//Tobacco
- cropTypes[9] = new CropTypes();
- cropTypes[9].soilType[0] = "Red";
- cropTypes[9].soilType[1] = null;
- cropTypes[9].soilType[2] = null;
- cropTypes[9].Temparature = 31.9f;
- cropTypes[9].Humidity = 62.4f;
- cropTypes[9].Moisture = 31.6f;
- cropTypes[9].Nitrogen = 19.1f;
- cropTypes[9].Potassium = 4.9f;
- cropTypes[9].Phosphorous = 19.3f;
+ cropTypes[10] = new CropTypes();
+ cropTypes[10].soilType[0] = "Red";
+ cropTypes[10].soilType[1] = null;
+ cropTypes[10].soilType[2] = null;
+ cropTypes[10].Temparature = 31.9f;
+ cropTypes[10].Humidity = 62.4f;
+ cropTypes[10].Moisture = 31.6f;
+ cropTypes[10].Nitrogen = 19.1f;
+ cropTypes[10].Potassium = 4.9f;
+ cropTypes[10].Phosphorous = 19.3f;
//Wheat
- cropTypes[10] = new CropTypes();
- cropTypes[10].soilType[0] = "Loamy";
- cropTypes[10].soilType[1] = null;
- cropTypes[10].soilType[2] = null;
- cropTypes[10].Temparature = 33.1f;
- cropTypes[10].Humidity = 63.8f;
- cropTypes[10].Moisture = 50.0f;
- cropTypes[10].Nitrogen = 23.3f;
- cropTypes[10].Potassium = 2.9f;
- cropTypes[10].Phosphorous = 14.4f;
+ cropTypes[11] = new CropTypes();
+ cropTypes[11].soilType[0] = "Loamy";
+ cropTypes[11].soilType[1] = null;
+ cropTypes[11].soilType[2] = null;
+ cropTypes[11].Temparature = 33.1f;
+ cropTypes[11].Humidity = 63.8f;
+ cropTypes[11].Moisture = 50.0f;
+ cropTypes[11].Nitrogen = 23.3f;
+ cropTypes[11].Potassium = 2.9f;
+ cropTypes[11].Phosphorous = 14.4f;
}
diff --git a/Game1/Sources/Crops/Crops.cs b/Game1/Sources/Crops/Crops.cs
index 9e060c1..86c438c 100644
--- a/Game1/Sources/Crops/Crops.cs
+++ b/Game1/Sources/Crops/Crops.cs
@@ -19,29 +19,30 @@ class Crops
private Vector2 Size;
private CropTypes DataSet;
SoilProperties soilProperties = new SoilProperties();
- private float ProductionRate = 0;
+ private float ProductionRate;
public void updateCrop(Vector2 newSize)
{
getProductionRate();
+ if (UpdateCrop == 60)
+ {
+ degradeSoil();
+ UpdateCrop = 0;
+ }
+
if (Status == 3 && Timer != 1)
{
Timer = Timer - 1f * ProductionRate;
}
Size = newSize;
UpdateCrop++;
- if (UpdateCrop == 60)
- {
- degradeSoil();
- UpdateCrop = 0;
- }
+
if (Timer < 1)
{
Timer = 1;
}
-
}
public SoilProperties getSoilProperties()
@@ -193,7 +194,7 @@ class Crops
return housePos;
}
- public void getProductionRate()
+ public float getProductionRate(CropTypes Sample)
{
ProductionRate = 1;
if (DataSet != null)
@@ -210,6 +211,7 @@ class Crops
}
ProductionRate = ProductionRate / 20;
}
+ return ProductionRate;
}
public float compareToDatset(float i, float j)
diff --git a/Game1/Sources/Crops/Farm.cs b/Game1/Sources/Crops/Farm.cs
index 17997d4..6167cd7 100644
--- a/Game1/Sources/Crops/Farm.cs
+++ b/Game1/Sources/Crops/Farm.cs
@@ -36,7 +36,7 @@ class Farm
crops[i, j] = new Crops();
crops[i, j].setStatus(x);
crops[i, j].setOriginalStatus();
- x = r.Next(0, 11);
+ x = r.Next(0, 12);
crops[i, j].setCropType(x, PresetCrops.getPresetCropTypes(x));
crops[i, j].init();
}
@@ -98,6 +98,30 @@ class Farm
public CropTypes getPresetCropTypes(int Index)
{
- return PresetCrops.getPresetCropTypes(Index);
+ return PresetCrops.getPresetCropTypes(Index - 1);
+ }
+
+ public void setCropType(int x, int y, int Type)
+ {
+ crops[x, y].setCropType(Type, PresetCrops.getPresetCropTypes(Type));
+ }
+
+ public int getHighestProductionRate(int x, int y)
+ {
+ int i = 1, holder = 0, holderIndex;
+ do
+ {
+ if (getProductionRate(x, y, i) > holder);
+ {
+ holderIndex = i;
+ }
+ i++;
+ } while (i < 12);
+ return holderIndex;
+ }
+
+ public float getProductionRate(int x, int y, int Type)
+ {
+ return crops[x, y].getProductionRate(PresetCrops.getPresetCropTypes(Type));
}
}
From bfad241a745007d5a7f62872793248a6db21e828 Mon Sep 17 00:00:00 2001
From: Joel
Date: Thu, 7 May 2020 20:07:11 +0200
Subject: [PATCH 10/15] fix
---
Game1/Sources/Crops/Crops.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Game1/Sources/Crops/Crops.cs b/Game1/Sources/Crops/Crops.cs
index 86c438c..1be67d0 100644
--- a/Game1/Sources/Crops/Crops.cs
+++ b/Game1/Sources/Crops/Crops.cs
@@ -25,7 +25,7 @@ class Crops
public void updateCrop(Vector2 newSize)
{
- getProductionRate();
+ getProductionRate(DataSet);
if (UpdateCrop == 60)
{
degradeSoil();
From fe35083968bcf05a7696a91b6ff91a9058b3b01f Mon Sep 17 00:00:00 2001
From: Joel
Date: Thu, 7 May 2020 21:46:33 +0200
Subject: [PATCH 11/15] Final ProductionRate
---
Game1/Sources/Crops/Crops.cs | 12 ++++++------
Game1/Sources/Crops/Farm.cs | 25 ++++++++++++++++++++-----
Game1/Sources/Smart/AI.cs | 3 +--
Game1/Sources/Smart/SmartTractor.cs | 2 +-
4 files changed, 28 insertions(+), 14 deletions(-)
diff --git a/Game1/Sources/Crops/Crops.cs b/Game1/Sources/Crops/Crops.cs
index 1be67d0..d99aa3b 100644
--- a/Game1/Sources/Crops/Crops.cs
+++ b/Game1/Sources/Crops/Crops.cs
@@ -199,12 +199,12 @@ class Crops
ProductionRate = 1;
if (DataSet != null)
{
- ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Temperature, DataSet.Temparature));
- ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Moisture, DataSet.Moisture));
- ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Humidity, DataSet.Humidity));
- ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Phosphorous, DataSet.Phosphorous));
- ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Potassium, DataSet.Potassium));
- ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Nitrogen, DataSet.Nitrogen));
+ ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Temperature, Sample.Temparature));
+ ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Moisture, Sample.Moisture));
+ ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Humidity, Sample.Humidity));
+ ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Phosphorous, Sample.Phosphorous));
+ ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Potassium, Sample.Potassium));
+ ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Nitrogen, Sample.Nitrogen));
if (ProductionRate < 0)
{
ProductionRate = 0;
diff --git a/Game1/Sources/Crops/Farm.cs b/Game1/Sources/Crops/Farm.cs
index 6167cd7..6340681 100644
--- a/Game1/Sources/Crops/Farm.cs
+++ b/Game1/Sources/Crops/Farm.cs
@@ -20,9 +20,9 @@ class Farm
PresetCrops.init();
r = new Random();
crops = new Crops[100, 100];
- for (int i = 0; i < Size.X; i++)
+ for (int i = 0; i < 99; i++)
{
- for (int j = 0; j < Size.Y; j++)
+ for (int j = 0; j < 99; j++)
{
int x = r.Next(0, 3);
if (x == 0)
@@ -106,14 +106,29 @@ class Farm
crops[x, y].setCropType(Type, PresetCrops.getPresetCropTypes(Type));
}
- public int getHighestProductionRate(int x, int y)
+ public void UpdatePreferedCrops(Vector2 Size)
{
- int i = 1, holder = 0, holderIndex;
+ for (int i = 0; i < Size.X; i++)
+ {
+ for (int j = 0; j < Size.X; j++)
+ {
+ int x = getHighestProductionRate(i, j);
+ crops[i,j].setCropType(x, PresetCrops.getPresetCropTypes(x));
+ }
+ }
+ }
+
+ private int getHighestProductionRate(int x, int y)
+ {
+ int i = 1, holderIndex = 0;
+ float holder = 0, SampleHolder = 0;
do
{
- if (getProductionRate(x, y, i) > holder);
+ holder = getProductionRate(x, y, i);
+ if (SampleHolder < holder)
{
holderIndex = i;
+ SampleHolder = holder;
}
i++;
} while (i < 12);
diff --git a/Game1/Sources/Smart/AI.cs b/Game1/Sources/Smart/AI.cs
index 38410a7..34f7d0d 100644
--- a/Game1/Sources/Smart/AI.cs
+++ b/Game1/Sources/Smart/AI.cs
@@ -34,9 +34,8 @@ class AI
inventory.addItem(7, 1);
inventory.addItem(7, 1);
inventory.addItem(10, 1);
- inventory.addItem(10, 1);
+ inventory.addItem(10, 1);
inventory.useItem(10, 1);
-
}
diff --git a/Game1/Sources/Smart/SmartTractor.cs b/Game1/Sources/Smart/SmartTractor.cs
index 74f5dae..4a909d7 100644
--- a/Game1/Sources/Smart/SmartTractor.cs
+++ b/Game1/Sources/Smart/SmartTractor.cs
@@ -17,10 +17,10 @@ class SmartTractor
public Path returnChoice()
{
ai.update(farm, Size, tractorPos / (tileSize + Spacing), housePos / (tileSize + Spacing), Target / (tileSize + Spacing), Rotation);
+ farm.UpdatePreferedCrops(Size);
farm = ai.changeCropStatus();
getTargetPosition(ai.newTarget());
astar.update(farm.getCrops(), Size, tractorPos / (tileSize + Spacing), housePos / (tileSize + Spacing), Target/(tileSize+Spacing), Rotation);
-
return astar.FindPath();
}
From 7a35bb09fe236bebb5f2948f896b5366f2835c8d Mon Sep 17 00:00:00 2001
From: BOTLester <58360400+BOTLester@users.noreply.github.com>
Date: Thu, 7 May 2020 22:09:45 +0200
Subject: [PATCH 12/15] Target Selection
---
Game1/Game1.csproj | 35 +++++++
Game1/Sources/Crops/Crops.cs | 5 +
Game1/Sources/Pathing/A-Star/Astar.cs | 21 +++-
Game1/Sources/Pathing/PQEntry.cs | 26 +++++
Game1/Sources/Pathing/PriorityQueueC5.cs | 49 ++++++++++
Game1/Sources/Smart/AI.cs | 117 +++++++++++++++++++++--
Game1/Sources/Smart/SmartTractor.cs | 6 +-
7 files changed, 245 insertions(+), 14 deletions(-)
create mode 100644 Game1/Sources/Pathing/PQEntry.cs
create mode 100644 Game1/Sources/Pathing/PriorityQueueC5.cs
diff --git a/Game1/Game1.csproj b/Game1/Game1.csproj
index 218552a..d01150d 100644
--- a/Game1/Game1.csproj
+++ b/Game1/Game1.csproj
@@ -17,6 +17,21 @@
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
x64
@@ -63,6 +78,9 @@
MinimumRecommendedRules.ruleset
true
+
+ false
+
@@ -86,6 +104,8 @@
+
+
@@ -118,6 +138,9 @@
+
+ 2.5.3
+
2.3.1
@@ -155,6 +178,18 @@
4.11.0
+
+
+ False
+ Microsoft .NET Framework 4.6.1 %28x86 and x64%29
+ true
+
+
+ False
+ .NET Framework 3.5 SP1
+ false
+
+