Bug fix in LightmapRenderer — Now water attenuates sunlight, new creature attribution: religion sphere

Former-commit-id: fd200afabaf318bec060a8fea9eb82da6f105aad
Former-commit-id: e035368f4d6d589bdb6822301fee763eb00df984
This commit is contained in:
Song Minjae
2016-02-25 01:28:00 +09:00
parent 19630e2147
commit c56e09505b
19 changed files with 209 additions and 171 deletions

View File

@@ -5,10 +5,15 @@ import java.util.Random;
/**
* Created by minjaesong on 16-02-03.
*/
public class Fudge3 {
public class Fudge3 extends FudgeDice {
public FudgeDice create(Random rand) {
return new FudgeDice(rand, 3);
/**
* Define new set of fudge dice with three dice.
* @param randfunc java.util.Random or its extension
*/
public Fudge3(Random randfunc) {
super(randfunc, 3);
}
}

View File

@@ -12,7 +12,7 @@ public class FudgeDice {
/**
* Define new set of fudge dice with given counts.
* @param randfunc
* @param randfunc java.util.Random or its extension
* @param counts amount of die
*/
public FudgeDice(Random randfunc, int counts) {
@@ -21,8 +21,8 @@ public class FudgeDice {
}
/**
* Roll dice and get result. Range: [-3, 3] for three dice
* @return
* Roll dice and get result.
* @return Normal distributed integer [-N , N] for diceCount of N. 0 is the most frequent return.
*/
public int roll() {
int diceResult = 0;
@@ -34,7 +34,7 @@ public class FudgeDice {
}
/**
* @return random [-1, 0, 1]
* @return integer randomly picked from {-1, 0, 1}
*/
private int rollSingleDie() {
return (randfunc.nextInt(3)) - 1;

View File

@@ -51,18 +51,16 @@
(kill the boss, defend their adobe, fast transportation, etc.)
-=*## What feeling do you want to convey to the player? ##*=-
-=*## What feeling do you want to convey? ##*=-
== Always think WHY would you want to add _something_ on the game ==
== Always think WHY you want to add _something_ on the game ==
- e.g. Why you are adding RPG leveling system?
- e.g. Why are you adding RPG leveling system? What it would do to the players? How would they play with?
See also:
HEARTS, CLUBS, DIAMONDS, SPADES: PLAYERS WHO SUIT MUDS
See also: HEARTS, CLUBS, DIAMONDS, SPADES: PLAYERS WHO SUIT MUDS
====================================

View File

@@ -76,7 +76,7 @@ public class CreatureBuildFactory {
for (String s : elemSet) {
float baseValue = jsonObject.get(s).getAsFloat();
// roll fudge dice and get value [-3, 3] as [0, 6]
int varSelected = new Fudge3().create(new HQRNG()).roll() + 3;
int varSelected = new Fudge3(new HQRNG()).roll() + 3;
// get multiplier from json. Assuming percentile
int multiplier = jsonObject.get(s + "variable").getAsJsonArray().get(varSelected).getAsInt();
float realValue = baseValue * multiplier / 100f;
@@ -121,7 +121,7 @@ public class CreatureBuildFactory {
for (String s : elemSet) {
float baseValue = 1f;
// roll fudge dice and get value [-3, 3] as [0, 6]
int varSelected = new Fudge3().create(new HQRNG()).roll() + 3;
int varSelected = new Fudge3(new HQRNG()).roll() + 3;
// get multiplier from json. Assuming percentile
int multiplier = jsonObject.get(s).getAsJsonArray().get(varSelected).getAsInt();
float realValue = baseValue * multiplier / 100f;

View File

@@ -1,5 +1,6 @@
package com.Torvald.Terrarum.Actors;
import com.Torvald.Rand.Fudge3;
import com.Torvald.Terrarum.Actors.Faction.Faction;
import com.Torvald.Terrarum.GameControl.EnumKeyFunc;
import com.Torvald.Terrarum.GameControl.KeyMap;
@@ -57,7 +58,7 @@ public class Player extends ActorWithBody implements Controllable, Pocketed, Fac
private final int TSIZE = MapDrawer.TILE_SIZE;
private char LUMINANCE_RGB = 31960;
private char LUMINANCE_RGB = 31399;
private HashSet<Faction> factionSet = new HashSet<>();

View File

@@ -254,19 +254,21 @@ public class LightmapRenderer {
char thisTileOpacity = TilePropCodex.getProp(thisTerrain).getOpacity();
char sunLight = Terrarum.game.map.getGlobalLight();
// MIX TILE
// open air
if (thisTerrain == AIR && thisWall == AIR) {
lightLevelThis = sunLight;
}
// luminous tile transparent (allows sunlight to pass)
else if (thisWall == AIR && thisTileLuminosity < COLOUR_DOMAIN_SIZE) {
else if (thisWall == AIR && thisTileLuminosity > 0) {
char darkenSunlight = darkenColoured(sunLight, thisTileOpacity);
lightLevelThis = screenBlend(darkenSunlight, thisTileLuminosity);
}
// luminous tile (opaque)
else {
else if (thisWall != AIR && thisTileLuminosity > 0) {
lightLevelThis = thisTileLuminosity;
}
// END MIX TILE
// mix lantern
for (LightmapLantern lantern : lanterns) {

View File

@@ -32,7 +32,7 @@
"27";"TILE_SNOW" ; "8205"; "6"; "0"; "N/A"; "1"; "1"; "0"; "27"; "0";"16"
"28";"TILE_ICE_FRAGILE" ; "3282"; "1"; "0"; "N/A"; "1"; "0"; "0"; "28"; "0";"16"
"29";"TILE_ICE_NATURAL" ; "6564"; "25"; "0"; "N/A"; "1"; "1"; "0"; "29"; "0"; "8"
"30";"TILE_ICE_CLEAR_MAGICAL" ; "8205"; "25"; "0"; "N/A"; "1"; "1"; "4967"; "30"; "0"; "8"
"30";"TILE_ICE_CLEAR_MAGICAL" ; "8205"; "25"; "0"; "N/A"; "1"; "1";"14949"; "30"; "0"; "8"
# see scandinavian name set female of this tile id!
"31";"TILE_PLATFORM_STONE" ; "0"; "0"; "0"; "N/A"; "0"; "0"; "0"; "31"; "0";"16"
"32";"TILE_PLATFORM_WOODEN" ; "0"; "0"; "0"; "N/A"; "0"; "0"; "0"; "32"; "0";"16"
Can't render this file because it contains an unexpected character in line 1 and column 12.