public override void generateVaild(System.Random rand, WorldCondition worldCond) { IdxContent = rand.Next() % 2; if (IdxContent == 0) { elements = new CondExprElement[3]; elements[0].type = CondExprElemntType.FaceFront; elements[0].meta = rand.Next() % 2; elements[2].type = CondExprElemntType.Dir; elements[2].meta = (int)dirMap[ rand.Next() % dirMap.Length ]; List<int> idxLighting = new List<int>(); for (int i = 0; i < 4; ++i ) { if ( worldCond.isTopFireLighting(i) ) { idxLighting.Add(i); } } int idx = idxLighting[rand.Next() % idxLighting.Count]; if (idx == 0) idx += 2; elements[1].type = CondExprElemntType.WallName; elements[1].meta = (int)worldCond.wall[ ( idx - elements[2].meta + 4 ) % 4 ].name; } else { elements = new CondExprElement[1]; elements[0].type = CondExprElemntType.IntValue; elements[0].meta = worldCond.getTopFireLightingNum(); } }
public override bool testVaild(WorldCondition worldCond) { if (IdxContent == 0) { return worldCond.isTopFireLighting((WallName)elements[1].meta, (CondDir)elements[0].meta, elements[2].meta != 0); } else { return elements[0].meta == worldCond.getTopFireLightingNum(); } }