repo_id stringlengths 6 101 | file_path stringlengths 2 269 | content stringlengths 367 5.14M | size int64 367 5.14M | filename stringlengths 1 248 | ext stringlengths 0 87 | lang stringclasses 88 values | program_lang stringclasses 232 values | doc_type stringclasses 5 values | quality_signal stringlengths 2 1.9k | effective stringclasses 2 values | hit_map stringlengths 2 1.4k |
|---|---|---|---|---|---|---|---|---|---|---|---|
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/scenes/ChangesScene.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.scenes;
import com.shatteredpixel.shatteredpixeldungeon.Chrome;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.ui.Archs;
import com.shatteredpixel.shatteredpixeldungeon.ui.ExitButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
import com.shatteredpixel.shatteredpixeldungeon.ui.ScrollPane;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.shatteredpixel.shatteredpixeldungeon.ui.changelist.ChangeInfo;
import com.shatteredpixel.shatteredpixeldungeon.ui.changelist.v0_1_X_Changes;
import com.shatteredpixel.shatteredpixeldungeon.ui.changelist.v0_2_X_Changes;
import com.shatteredpixel.shatteredpixeldungeon.ui.changelist.v0_3_X_Changes;
import com.shatteredpixel.shatteredpixeldungeon.ui.changelist.v0_4_X_Changes;
import com.shatteredpixel.shatteredpixeldungeon.ui.changelist.v0_5_X_Changes;
import com.shatteredpixel.shatteredpixeldungeon.ui.changelist.v0_6_X_Changes;
import com.shatteredpixel.shatteredpixeldungeon.ui.changelist.v0_7_X_Changes;
import com.watabou.noosa.Camera;
import com.watabou.noosa.NinePatch;
import com.watabou.noosa.ui.Component;
import java.util.ArrayList;
public class ChangesScene extends PixelScene {
public static int changesSelected = 0;
@Override
public void create() {
super.create();
int w = Camera.main.width;
int h = Camera.main.height;
RenderedTextBlock title = PixelScene.renderTextBlock( Messages.get(this, "title"), 9 );
title.hardlight(Window.TITLE_COLOR);
title.setPos(
(w - title.width()) / 2f,
(20 - title.height()) / 2f
);
align(title);
add(title);
ExitButton btnExit = new ExitButton();
btnExit.setPos( Camera.main.width - btnExit.width(), 0 );
add( btnExit );
NinePatch panel = Chrome.get(Chrome.Type.TOAST);
int pw = 135 + panel.marginLeft() + panel.marginRight() - 2;
int ph = h - 35;
panel.size( pw, ph );
panel.x = (w - pw) / 2f;
panel.y = title.bottom() + 4;
align( panel );
add( panel );
final ArrayList<ChangeInfo> changeInfos = new ArrayList<>();
switch (changesSelected){
case 0: default:
v0_7_X_Changes.addAllChanges(changeInfos);
break;
case 1:
v0_6_X_Changes.addAllChanges(changeInfos);
break;
case 2:
v0_5_X_Changes.addAllChanges(changeInfos);
v0_4_X_Changes.addAllChanges(changeInfos);
v0_3_X_Changes.addAllChanges(changeInfos);
v0_2_X_Changes.addAllChanges(changeInfos);
v0_1_X_Changes.addAllChanges(changeInfos);
break;
}
ScrollPane list = new ScrollPane( new Component() ){
@Override
public void onClick(float x, float y) {
for (ChangeInfo info : changeInfos){
if (info.onClick( x, y )){
return;
}
}
}
};
add( list );
Component content = list.content();
content.clear();
float posY = 0;
float nextPosY = 0;
boolean second = false;
for (ChangeInfo info : changeInfos){
if (info.major) {
posY = nextPosY;
second = false;
info.setRect(0, posY, panel.innerWidth(), 0);
content.add(info);
posY = nextPosY = info.bottom();
} else {
if (!second){
second = true;
info.setRect(0, posY, panel.innerWidth()/2f, 0);
content.add(info);
nextPosY = info.bottom();
} else {
second = false;
info.setRect(panel.innerWidth()/2f, posY, panel.innerWidth()/2f, 0);
content.add(info);
nextPosY = Math.max(info.bottom(), nextPosY);
posY = nextPosY;
}
}
}
content.setSize( panel.innerWidth(), (int)Math.ceil(posY) );
list.setRect(
panel.x + panel.marginLeft(),
panel.y + panel.marginTop() - 1,
panel.innerWidth(),
panel.innerHeight() + 2);
list.scrollTo(0, 0);
RedButton btn0_7 = new RedButton("v0.7"){
@Override
protected void onClick() {
super.onClick();
if (changesSelected != 0) {
changesSelected = 0;
ShatteredPixelDungeon.seamlessResetScene();
}
}
};
if (changesSelected == 0) btn0_7.textColor(Window.TITLE_COLOR);
btn0_7.setRect(list.left()-3, list.bottom()+5, 45, 14);
add(btn0_7);
RedButton btn0_6 = new RedButton("v0.6"){
@Override
protected void onClick() {
super.onClick();
if (changesSelected != 1) {
changesSelected = 1;
ShatteredPixelDungeon.seamlessResetScene();
}
}
};
if (changesSelected == 1) btn0_6.textColor(Window.TITLE_COLOR);
btn0_6.setRect(btn0_7.right() + 2, btn0_7.top(), 45, 14);
add(btn0_6);
RedButton btnOld = new RedButton("v0.5-v0.1"){
@Override
protected void onClick() {
super.onClick();
if (changesSelected != 2) {
changesSelected = 2;
ShatteredPixelDungeon.seamlessResetScene();
}
}
};
if (changesSelected == 2) btnOld.textColor(Window.TITLE_COLOR);
btnOld.setRect(btn0_6.right() + 2, btn0_7.top(), 45, 14);
add(btnOld);
Archs archs = new Archs();
archs.setSize( Camera.main.width, Camera.main.height );
addToBack( archs );
fadeIn();
}
@Override
protected void onBackPressed() {
ShatteredPixelDungeon.switchNoFade(TitleScene.class);
}
}
| 6,038 | ChangesScene | java | en | java | code | {"qsc_code_num_words": 729, "qsc_code_num_chars": 6038.0, "qsc_code_mean_word_length": 5.79835391, "qsc_code_frac_words_unique": 0.27434842, "qsc_code_frac_chars_top_2grams": 0.04258339, "qsc_code_frac_chars_top_3grams": 0.16181689, "qsc_code_frac_chars_top_4grams": 0.17695765, "qsc_code_frac_chars_dupe_5grams": 0.37686302, "qsc_code_frac_chars_dupe_6grams": 0.25076887, "qsc_code_frac_chars_dupe_7grams": 0.17861367, "qsc_code_frac_chars_dupe_8grams": 0.16489236, "qsc_code_frac_chars_dupe_9grams": 0.11450201, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.02676788, "qsc_code_frac_chars_whitespace": 0.17091752, "qsc_code_size_file_byte": 6038.0, "qsc_code_num_lines": 206.0, "qsc_code_num_chars_line_max": 90.0, "qsc_code_num_chars_line_mean": 29.31067961, "qsc_code_frac_chars_alphabet": 0.81761886, "qsc_code_frac_chars_comments": 0.12934747, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.20886076, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0041849, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.03797468, "qsc_codejava_score_lines_no_logic": 0.1835443, "qsc_codejava_frac_words_no_modifier": 0.85714286, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/scenes/CellSelector.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.scenes;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap;
import com.shatteredpixel.shatteredpixeldungeon.SPDSettings;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.watabou.noosa.Camera;
import com.shatteredpixel.shatteredpixeldungeon.input.GameAction;
import com.shatteredpixel.shatteredpixeldungeon.input.PDInputProcessor;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.watabou.input.NoosaInputProcessor;
import com.watabou.noosa.TouchArea;
import com.watabou.utils.GameMath;
import com.watabou.utils.Point;
import com.watabou.utils.PointF;
public class CellSelector extends TouchArea<GameAction> {
public Listener listener = null;
public boolean enabled;
private float mouseZoom;
private float dragThreshold;
private NoosaInputProcessor.Key<GameAction> pressedKey;
private float pressedKeySpeedFactor = 0.05f;
public CellSelector( DungeonTilemap map ) {
super( map );
camera = map.camera();
mouseZoom = camera.zoom;
dragThreshold = PixelScene.defaultZoom * DungeonTilemap.SIZE / 2;
}
@Override
protected void onClick( NoosaInputProcessor.Touch touch ) {
if (dragging) {
dragging = false;
} else {
PointF p = Camera.main.screenToCamera( (int)touch.current.x, (int)touch.current.y );
for (Char mob : Dungeon.level.mobs.toArray(new Mob[0])){
if (mob.sprite != null && mob.sprite.overlapsPoint( p.x, p.y)){
select( mob.pos );
return;
}
}
for (Heap heap : Dungeon.level.heaps.valueList()){
if (heap.sprite != null && heap.sprite.overlapsPoint( p.x, p.y)){
select( heap.pos );
return;
}
}
select( ((DungeonTilemap)target).screenToTile(
(int)touch.current.x,
(int)touch.current.y,
true ) );
}
}
@Override
public boolean onKeyDown(NoosaInputProcessor.Key<GameAction> key) {
switch (key.action) {
case ZOOM_IN:
zoom( camera.zoom + 1 );
return true;
case ZOOM_OUT:
zoom( camera.zoom - 1 );
return true;
case ZOOM_DEFAULT:
zoom( PixelScene.defaultZoom );
return true;
}
boolean handled = true;
int x = 0, y = 0;
switch (key.action) {
case MOVE_UP:
y = -1;
break;
case MOVE_DOWN:
y = 1;
break;
case MOVE_LEFT:
x = -1;
break;
case MOVE_RIGHT:
x = 1;
break;
case MOVE_TOP_LEFT:
x = -1;
y = -1;
break;
case MOVE_TOP_RIGHT:
x = 1;
y = -1;
break;
case MOVE_BOTTOM_LEFT:
x = -1;
y = 1;
break;
case MOVE_BOTTOM_RIGHT:
x = 1;
y = 1;
break;
case OPERATE:
break;
default:
handled = false;
break;
}
if (handled) {
CharSprite.setMoveInterval(Math.max(0.1f, 0.1f + pressedKeySpeedFactor));
Point point = DungeonTilemap.tileToPoint(Dungeon.hero.pos);
point.x += x;
point.y += y;
pressedKey = key;
select(DungeonTilemap.pointToTile(point));
}
return handled;
}
@Override
public boolean onKeyUp( PDInputProcessor.Key<GameAction> key ) {
if (pressedKey != null && key.action == pressedKey.action) {
resetKeyHold();
}
switch (key.code) {
case PDInputProcessor.MODIFIER_KEY:
mouseZoom = zoom( Math.round( mouseZoom ) );
return true;
default:
return false;
}
}
public void processKeyHold(){
if (pressedKey != null) {
enabled = true;
pressedKeySpeedFactor -= 0.025f;
CharSprite.setMoveInterval(Math.max(0.1f, 0.1f + pressedKeySpeedFactor));
onKeyDown(pressedKey);
}
}
public void resetKeyHold(){
pressedKeySpeedFactor = 0.05f;
pressedKey = null;
CharSprite.setMoveInterval(0.1f);
}
private float zoom( float value ) {
value = GameMath.gate( PixelScene.minZoom, value, PixelScene.maxZoom );
SPDSettings.zoom((int) (value - PixelScene.defaultZoom));
camera.zoom( value );
//Resets character sprite positions with the new camera zoom
//This is important as characters are centered on a 16x16 tile, but may have any sprite size
//This can lead to none-whole coordinate, which need to be aligned with the zoom
for (Char c : Actor.chars()){
if (c.sprite != null && !c.sprite.isMoving){
c.sprite.point(c.sprite.worldToCamera(c.pos));
}
}
return value;
}
public void select( int cell ) {
if (enabled && listener != null && cell != -1) {
listener.onSelect( cell );
GameScene.ready();
} else {
GameScene.cancel();
}
}
private boolean pinching = false;
private NoosaInputProcessor.Touch another;
private float startZoom;
private float startSpan;
@Override
protected void onTouchDown( NoosaInputProcessor.Touch t ) {
if (t != touch && another == null) {
if (!touch.down) {
touch = t;
onTouchDown( t );
return;
}
pinching = true;
another = t;
startSpan = PointF.distance( touch.current, another.current );
startZoom = camera.zoom;
dragging = false;
} else if (t != touch) {
reset();
}
}
@Override
protected void onTouchUp( NoosaInputProcessor.Touch t ) {
if (pinching && (t == touch || t == another)) {
pinching = false;
zoom(Math.round( camera.zoom ));
dragging = true;
if (t == touch) {
touch = another;
}
another = null;
lastPos.set( touch.current );
}
}
private boolean dragging = false;
private PointF lastPos = new PointF();
@Override
public boolean onMouseScroll(int scroll) {
mouseZoom -= scroll / 3f;
if (PDInputProcessor.modifier) {
mouseZoom = zoom( mouseZoom );
} else {
zoom( Math.round( mouseZoom ) );
mouseZoom = GameMath.gate( PixelScene.minZoom, mouseZoom, PixelScene.maxZoom );
}
return true;
}
@Override
protected void onDrag( NoosaInputProcessor.Touch t ) {
if (pinching) {
float curSpan = PointF.distance( touch.current, another.current );
float zoom = (startZoom * curSpan / startSpan);
camera.zoom( GameMath.gate(
PixelScene.minZoom,
zoom - (zoom % 0.1f),
PixelScene.maxZoom ) );
} else {
if (!dragging && PointF.distance( t.current, t.start ) > dragThreshold) {
dragging = true;
lastPos.set( t.current );
} else if (dragging) {
camera.shift( PointF.diff( lastPos, t.current ).invScale( camera.zoom ) );
lastPos.set( t.current );
}
}
}
public void cancel() {
if (listener != null) {
listener.onSelect( null );
}
GameScene.ready();
}
@Override
public void reset() {
super.reset();
another = null;
if (pinching){
pinching = false;
zoom( Math.round( camera.zoom ) );
}
}
public void enable(boolean value){
if (enabled != value){
enabled = value;
}
}
public interface Listener {
void onSelect( Integer cell );
String prompt();
}
}
| 7,773 | CellSelector | java | en | java | code | {"qsc_code_num_words": 906, "qsc_code_num_chars": 7773.0, "qsc_code_mean_word_length": 5.76379691, "qsc_code_frac_words_unique": 0.27152318, "qsc_code_frac_chars_top_2grams": 0.02757564, "qsc_code_frac_chars_top_3grams": 0.08004596, "qsc_code_frac_chars_top_4grams": 0.0842589, "qsc_code_frac_chars_dupe_5grams": 0.19494447, "qsc_code_frac_chars_dupe_6grams": 0.11643049, "qsc_code_frac_chars_dupe_7grams": 0.09038682, "qsc_code_frac_chars_dupe_8grams": 0.06108771, "qsc_code_frac_chars_dupe_9grams": 0.02259671, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01028236, "qsc_code_frac_chars_whitespace": 0.21175865, "qsc_code_size_file_byte": 7773.0, "qsc_code_num_lines": 333.0, "qsc_code_num_chars_line_max": 95.0, "qsc_code_num_chars_line_mean": 23.34234234, "qsc_code_frac_chars_alphabet": 0.84201077, "qsc_code_frac_chars_comments": 0.13032291, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.256, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.064, "qsc_codejava_score_lines_no_logic": 0.196, "qsc_codejava_frac_words_no_modifier": 0.82352941, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 1 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/scenes/StartScene.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.scenes;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Chrome;
import com.shatteredpixel.shatteredpixeldungeon.GamesInProgress;
import com.shatteredpixel.shatteredpixeldungeon.SPDSettings;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
import com.shatteredpixel.shatteredpixeldungeon.journal.Journal;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.ui.Archs;
import com.shatteredpixel.shatteredpixeldungeon.ui.ExitButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndGameInProgress;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndStartGame;
import com.watabou.noosa.BitmapText;
import com.watabou.noosa.Camera;
import com.watabou.noosa.Image;
import com.watabou.noosa.NinePatch;
import com.watabou.noosa.ui.Button;
import java.util.ArrayList;
public class StartScene extends PixelScene {
private static final int SLOT_WIDTH = 120;
private static final int SLOT_HEIGHT = 30;
@Override
public void create() {
super.create();
Badges.loadGlobal();
Journal.loadGlobal();
uiCamera.visible = false;
int w = Camera.main.width;
int h = Camera.main.height;
Archs archs = new Archs();
archs.setSize( w, h );
add( archs );
ExitButton btnExit = new ExitButton();
btnExit.setPos( w - btnExit.width(), 0 );
add( btnExit );
RenderedTextBlock title = PixelScene.renderTextBlock( Messages.get(this, "title"), 9);
title.hardlight(Window.TITLE_COLOR);
title.setPos(
(w - title.width()) / 2f,
(20 - title.height()) / 2f
);
align(title);
add(title);
ArrayList<GamesInProgress.Info> games = GamesInProgress.checkAll();
int slotGap = SPDSettings.landscape() ? 5 : 10;
int slotCount = Math.min(GamesInProgress.MAX_SLOTS, games.size()+1);
int slotsHeight = slotCount*SLOT_HEIGHT + (slotCount-1)* slotGap;
float yPos = (h - slotsHeight)/2f;
if (SPDSettings.landscape()) yPos += 8;
for (GamesInProgress.Info game : games) {
SaveSlotButton existingGame = new SaveSlotButton();
existingGame.set(game.slot);
existingGame.setRect((w - SLOT_WIDTH) / 2f, yPos, SLOT_WIDTH, SLOT_HEIGHT);
yPos += SLOT_HEIGHT + slotGap;
align(existingGame);
add(existingGame);
}
if (games.size() < GamesInProgress.MAX_SLOTS){
SaveSlotButton newGame = new SaveSlotButton();
newGame.set(GamesInProgress.firstEmpty());
newGame.setRect((w - SLOT_WIDTH) / 2f, yPos, SLOT_WIDTH, SLOT_HEIGHT);
yPos += SLOT_HEIGHT + slotGap;
align(newGame);
add(newGame);
}
GamesInProgress.curSlot = 0;
fadeIn();
}
@Override
protected void onBackPressed() {
ShatteredPixelDungeon.switchNoFade( TitleScene.class );
}
private static class SaveSlotButton extends Button {
private NinePatch bg;
private Image hero;
private RenderedTextBlock name;
private Image steps;
private BitmapText depth;
private Image classIcon;
private BitmapText level;
private int slot;
private boolean newGame;
@Override
protected void createChildren() {
super.createChildren();
bg = Chrome.get(Chrome.Type.GEM);
add( bg);
name = PixelScene.renderTextBlock(9);
add(name);
}
public void set( int slot ){
this.slot = slot;
GamesInProgress.Info info = GamesInProgress.check(slot);
newGame = info == null;
if (newGame){
name.text( Messages.get(StartScene.class, "new"));
if (hero != null){
remove(hero);
hero = null;
remove(steps);
steps = null;
remove(depth);
depth = null;
remove(classIcon);
classIcon = null;
remove(level);
level = null;
}
} else {
if (info.subClass != HeroSubClass.NONE){
name.text(Messages.titleCase(info.subClass.title()));
} else {
name.text(Messages.titleCase(info.heroClass.title()));
}
if (hero == null){
hero = new Image(info.heroClass.spritesheet(), 0, 15*info.armorTier, 12, 15);
add(hero);
steps = new Image(Icons.get(Icons.DEPTH));
add(steps);
depth = new BitmapText(PixelScene.pixelFont);
add(depth);
classIcon = new Image(Icons.get(info.heroClass));
add(classIcon);
level = new BitmapText(PixelScene.pixelFont);
add(level);
} else {
hero.copy(new Image(info.heroClass.spritesheet(), 0, 15*info.armorTier, 12, 15));
classIcon.copy(Icons.get(info.heroClass));
}
depth.text(Integer.toString(info.depth));
depth.measure();
level.text(Integer.toString(info.level));
level.measure();
if (info.challenges > 0){
name.hardlight(Window.TITLE_COLOR);
depth.hardlight(Window.TITLE_COLOR);
level.hardlight(Window.TITLE_COLOR);
} else {
name.resetColor();
depth.resetColor();
level.resetColor();
}
}
layout();
}
@Override
protected void layout() {
super.layout();
bg.x = x;
bg.y = y;
bg.size( width, height );
if (hero != null){
hero.x = x+8;
hero.y = y + (height - hero.height())/2f;
align(hero);
name.setPos(
hero.x + hero.width() + 6,
y + (height - name.height())/2f
);
align(name);
classIcon.x = x + width - 24 + (16 - classIcon.width())/2f;
classIcon.y = y + (height - classIcon.height())/2f;
align(classIcon);
level.x = classIcon.x + (classIcon.width() - level.width()) / 2f;
level.y = classIcon.y + (classIcon.height() - level.height()) / 2f + 1;
align(level);
steps.x = x + width - 40 + (16 - steps.width())/2f;
steps.y = y + (height - steps.height())/2f;
align(steps);
depth.x = steps.x + (steps.width() - depth.width()) / 2f;
depth.y = steps.y + (steps.height() - depth.height()) / 2f + 1;
align(depth);
} else {
name.setPos(
x + (width - name.width())/2f,
y + (height - name.height())/2f
);
align(name);
}
}
@Override
protected void onClick() {
if (newGame) {
ShatteredPixelDungeon.scene().add( new WndStartGame(slot));
} else {
ShatteredPixelDungeon.scene().add( new WndGameInProgress(slot));
}
}
}
}
| 7,336 | StartScene | java | en | java | code | {"qsc_code_num_words": 844, "qsc_code_num_chars": 7336.0, "qsc_code_mean_word_length": 5.83412322, "qsc_code_frac_words_unique": 0.26066351, "qsc_code_frac_chars_top_2grams": 0.03655565, "qsc_code_frac_chars_top_3grams": 0.12347685, "qsc_code_frac_chars_top_4grams": 0.13403737, "qsc_code_frac_chars_dupe_5grams": 0.18034119, "qsc_code_frac_chars_dupe_6grams": 0.0714866, "qsc_code_frac_chars_dupe_7grams": 0.06011373, "qsc_code_frac_chars_dupe_8grams": 0.04874086, "qsc_code_frac_chars_dupe_9grams": 0.04874086, "qsc_code_frac_chars_dupe_10grams": 0.04874086, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01330604, "qsc_code_frac_chars_whitespace": 0.20092694, "qsc_code_size_file_byte": 7336.0, "qsc_code_num_lines": 268.0, "qsc_code_num_chars_line_max": 89.0, "qsc_code_num_chars_line_mean": 27.37313433, "qsc_code_frac_chars_alphabet": 0.82668031, "qsc_code_frac_chars_comments": 0.10646129, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.13402062, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00122044, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.03092784, "qsc_codejava_score_lines_no_logic": 0.19072165, "qsc_codejava_frac_words_no_modifier": 0.85714286, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 1 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/scenes/TitleScene.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.scenes;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Chrome;
import com.shatteredpixel.shatteredpixeldungeon.GamesInProgress;
import com.shatteredpixel.shatteredpixeldungeon.SPDSettings;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.effects.BannerSprites;
import com.shatteredpixel.shatteredpixeldungeon.effects.Fireball;
import com.shatteredpixel.shatteredpixeldungeon.input.GameAction;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.ui.Archs;
import com.shatteredpixel.shatteredpixeldungeon.ui.ExitButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
import com.shatteredpixel.shatteredpixeldungeon.ui.LanguageButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.PrefsButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.StyledButton;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions;
import com.shatteredpixel.shatteredpixeldungeon.ui.UpdateNotification;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndStartGame;
import com.watabou.glwrap.Blending;
import com.watabou.noosa.BitmapText;
import com.watabou.noosa.Camera;
import com.watabou.noosa.Game;
import com.watabou.noosa.Image;
import com.watabou.noosa.audio.Music;
import com.watabou.utils.DeviceCompat;
public class TitleScene extends PixelScene {
@Override
public void create() {
super.create();
Music.INSTANCE.play( Assets.THEME, true );
uiCamera.visible = false;
int w = Camera.main.width;
int h = Camera.main.height;
Archs archs = new Archs();
archs.setSize( w, h );
add( archs );
Image title = BannerSprites.get( BannerSprites.Type.PIXEL_DUNGEON );
add( title );
float topRegion = Math.max(title.height, h*0.45f);
title.x = (w - title.width()) / 2f;
if (SPDSettings.landscape()) {
title.y = (topRegion - title.height()) / 2f;
} else {
title.y = 20 + (topRegion - title.height() - 20) / 2f;
}
align(title);
placeTorch(title.x + 22, title.y + 46);
placeTorch(title.x + title.width - 22, title.y + 46);
Image signs = new Image( BannerSprites.get( BannerSprites.Type.PIXEL_DUNGEON_SIGNS ) ) {
private float time = 0;
@Override
public void update() {
super.update();
am = Math.max(0f, (float)Math.sin( time += Game.elapsed ));
if (time >= 1.5f*Math.PI) time = 0;
}
@Override
public void draw() {
Blending.setLightMode();
super.draw();
Blending.setNormalMode();
}
};
signs.x = title.x + (title.width() - signs.width())/2f;
signs.y = title.y;
add( signs );
TitleButton btnPlay = new TitleButton(Messages.get(this, "enter")){
@Override
protected void onClick() {
if (GamesInProgress.checkAll().size() == 0){
TitleScene.this.add( new WndStartGame(1) );
} else {
ShatteredPixelDungeon.switchNoFade( StartScene.class );
}
}
@Override
protected boolean onLongClick() {
//making it easier to start runs quickly while debugging
if (DeviceCompat.isDebug()) {
TitleScene.this.add( new WndStartGame(1) );
return true;
}
return super.onLongClick();
}
};
btnPlay.icon(Icons.get(Icons.ENTER));
add(btnPlay);
TitleButton btnSupport = new TitleButton(Messages.get(this, "support")){
@Override
protected void onClick() {
WndOptions wnd = new WndOptions(Messages.get(TitleScene.class, "support"),
Messages.get(TitleScene.class, "patreon_body"),
Messages.get(TitleScene.class, "patreon_button")){
@Override
protected void onSelect(int index) {
if (index == 0){
DeviceCompat.openURI("https://www.patreon.com/ShatteredPixel");
} else {
hide();
}
}
};
parent.add(wnd);
}
};
btnSupport.icon(Icons.get(Icons.GOLD));
add(btnSupport);
TitleButton btnRankings = new TitleButton(Messages.get(this, "rankings")){
@Override
protected void onClick() {
ShatteredPixelDungeon.switchNoFade( RankingsScene.class );
}
};
btnRankings.icon(Icons.get(Icons.RANKINGS));
add(btnRankings);
TitleButton btnBadges = new TitleButton(Messages.get(this, "badges")){
@Override
protected void onClick() {
ShatteredPixelDungeon.switchNoFade( BadgesScene.class );
}
};
btnBadges.icon(Icons.get(Icons.BADGES));
add(btnBadges);
TitleButton btnChanges = new TitleButton(Messages.get(this, "changes")){
@Override
protected void onClick() {
ChangesScene.changesSelected = 0;
ShatteredPixelDungeon.switchNoFade( ChangesScene.class );
}
};
btnChanges.icon(Icons.get(Icons.CHANGES));
add(btnChanges);
TitleButton btnAbout = new TitleButton(Messages.get(this, "about")){
@Override
protected void onClick() {
ShatteredPixelDungeon.switchNoFade( AboutScene.class );
}
};
btnAbout.icon(Icons.get(Icons.SHPX));
add(btnAbout);
final int BTN_HEIGHT = 21;
int GAP = (int)(h - topRegion - (SPDSettings.landscape() ? 3 : 4)*BTN_HEIGHT)/3;
GAP /= SPDSettings.landscape() ? 3 : 4;
GAP = Math.max(GAP, 2);
if (SPDSettings.landscape()) {
btnPlay.setRect(title.x-50, topRegion+GAP, ((title.width()+100)/2)-1, BTN_HEIGHT);
align(btnPlay);
btnSupport.setRect(btnPlay.right()+2, btnPlay.top(), btnPlay.width(), BTN_HEIGHT);
btnRankings.setRect(btnPlay.left() + (btnPlay.width()*.33f)+1, btnPlay.bottom()+ GAP, (btnPlay.width()*.67f)-1, BTN_HEIGHT);
btnBadges.setRect(btnRankings.right()+2, btnRankings.top(), btnRankings.width(), BTN_HEIGHT);
btnChanges.setRect(btnRankings.left(), btnRankings.bottom() + GAP, btnRankings.width(), BTN_HEIGHT);
btnAbout.setRect(btnChanges.right()+2, btnChanges.top(), btnRankings.width(), BTN_HEIGHT);
} else {
btnPlay.setRect(title.x, topRegion+GAP, title.width(), BTN_HEIGHT);
align(btnPlay);
btnRankings.setRect(btnPlay.left(), btnPlay.bottom()+ GAP, (btnPlay.width()/2)-1, BTN_HEIGHT);
btnBadges.setRect(btnRankings.right()+2, btnRankings.top(), btnRankings.width(), BTN_HEIGHT);
btnChanges.setRect(btnRankings.left(), btnRankings.bottom()+ GAP, btnRankings.width(), BTN_HEIGHT);
btnAbout.setRect(btnChanges.right()+2, btnChanges.top(), btnChanges.width(), BTN_HEIGHT);
btnSupport.setRect(btnPlay.left(), btnAbout.bottom()+ GAP, btnPlay.width(), BTN_HEIGHT);
}
BitmapText version = new BitmapText( "v" + Game.version, pixelFont);
version.measure();
version.hardlight( 0x888888 );
version.x = w - version.width() - 4;
version.y = h - version.height() - 2;
add( version );
int pos = 2;
PrefsButton btnPrefs = new PrefsButton();
btnPrefs.setRect( pos, 0, 16, 20 );
add( btnPrefs );
pos += btnPrefs.width();
LanguageButton btnLang = new LanguageButton();
btnLang.setRect(pos, 0, 16, 20);
add( btnLang );
ExitButton btnExit = new ExitButton();
btnExit.setPos( w - btnExit.width(), 0 );
add( btnExit );
UpdateNotification updInfo = new UpdateNotification();
updInfo.setPos(2, h-19);
add(updInfo);
fadeIn();
}
private void placeTorch( float x, float y ) {
Fireball fb = new Fireball();
fb.setPos( x, y );
add( fb );
}
private static class TitleButton extends StyledButton {
public TitleButton( String label ){
this(label, 9);
}
public TitleButton( String label, int size ){
super(Chrome.Type.GREY_BUTTON_TR, label, size);
}
}
}
| 8,265 | TitleScene | java | en | java | code | {"qsc_code_num_words": 956, "qsc_code_num_chars": 8265.0, "qsc_code_mean_word_length": 6.10983264, "qsc_code_frac_words_unique": 0.2709205, "qsc_code_frac_chars_top_2grams": 0.0385208, "qsc_code_frac_chars_top_3grams": 0.12360897, "qsc_code_frac_chars_top_4grams": 0.13559322, "qsc_code_frac_chars_dupe_5grams": 0.31176168, "qsc_code_frac_chars_dupe_6grams": 0.14329738, "qsc_code_frac_chars_dupe_7grams": 0.06950865, "qsc_code_frac_chars_dupe_8grams": 0.06950865, "qsc_code_frac_chars_dupe_9grams": 0.06950865, "qsc_code_frac_chars_dupe_10grams": 0.06950865, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01424256, "qsc_code_frac_chars_whitespace": 0.15898367, "qsc_code_size_file_byte": 8265.0, "qsc_code_num_lines": 254.0, "qsc_code_num_chars_line_max": 128.0, "qsc_code_num_chars_line_mean": 32.53937008, "qsc_code_frac_chars_alphabet": 0.82606819, "qsc_code_frac_chars_comments": 0.10127042, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.19796954, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.01480883, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.00107701, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.06091371, "qsc_codejava_score_lines_no_logic": 0.19796954, "qsc_codejava_frac_words_no_modifier": 0.92307692, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 1 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfFrost.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.potions;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Freezing;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.PathFinder;
public class PotionOfFrost extends Potion {
{
initials = 1;
}
@Override
public void shatter( int cell ) {
if (Dungeon.level.heroFOV[cell]) {
setKnown();
splash( cell );
Sample.INSTANCE.play( Assets.SND_SHATTER );
}
for (int offset : PathFinder.NEIGHBOURS9){
if (!Dungeon.level.solid[cell+offset]) {
GameScene.add(Blob.seed(cell + offset, 10, Freezing.class));
}
}
}
@Override
public int price() {
return isKnown() ? 30 * quantity : super.price();
}
}
| 1,759 | PotionOfFrost | java | en | java | code | {"qsc_code_num_words": 225, "qsc_code_num_chars": 1759.0, "qsc_code_mean_word_length": 5.75555556, "qsc_code_frac_words_unique": 0.56888889, "qsc_code_frac_chars_top_2grams": 0.04864865, "qsc_code_frac_chars_top_3grams": 0.17606178, "qsc_code_frac_chars_top_4grams": 0.16988417, "qsc_code_frac_chars_dupe_5grams": 0.14826255, "qsc_code_frac_chars_dupe_6grams": 0.12818533, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01578586, "qsc_code_frac_chars_whitespace": 0.17168846, "qsc_code_size_file_byte": 1759.0, "qsc_code_num_lines": 61.0, "qsc_code_num_chars_line_max": 72.0, "qsc_code_num_chars_line_mean": 28.83606557, "qsc_code_frac_chars_alphabet": 0.87302677, "qsc_code_frac_chars_comments": 0.44400227, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.06666667, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.1, "qsc_codejava_score_lines_no_logic": 0.36666667, "qsc_codejava_frac_words_no_modifier": 0.5, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfHaste.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.potions;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Haste;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
public class PotionOfHaste extends Potion {
{
initials = 2;
}
@Override
public void apply(Hero hero) {
setKnown();
GLog.w( Messages.get(this, "energetic") );
Buff.prolong( hero, Haste.class, Haste.DURATION);
}
@Override
public int price() {
return isKnown() ? 40 * quantity : super.price();
}
}
| 1,498 | PotionOfHaste | java | en | java | code | {"qsc_code_num_words": 197, "qsc_code_num_chars": 1498.0, "qsc_code_mean_word_length": 5.73604061, "qsc_code_frac_words_unique": 0.58375635, "qsc_code_frac_chars_top_2grams": 0.09026549, "qsc_code_frac_chars_top_3grams": 0.20176991, "qsc_code_frac_chars_top_4grams": 0.19469027, "qsc_code_frac_chars_dupe_5grams": 0.21415929, "qsc_code_frac_chars_dupe_6grams": 0.14690265, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01588562, "qsc_code_frac_chars_whitespace": 0.15954606, "qsc_code_size_file_byte": 1498.0, "qsc_code_num_lines": 48.0, "qsc_code_num_chars_line_max": 72.0, "qsc_code_num_chars_line_mean": 31.20833333, "qsc_code_frac_chars_alphabet": 0.8816521, "qsc_code_frac_chars_comments": 0.52069426, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.0952381, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.01253482, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.14285714, "qsc_codejava_score_lines_no_logic": 0.42857143, "qsc_codejava_frac_words_no_modifier": 0.5, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfExperience.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.potions;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
public class PotionOfExperience extends Potion {
{
initials = 0;
bones = true;
}
@Override
public void apply( Hero hero ) {
setKnown();
hero.earnExp( hero.maxExp(), getClass() );
}
@Override
public int price() {
return isKnown() ? 50 * quantity : super.price();
}
}
| 1,204 | PotionOfExperience | java | en | java | code | {"qsc_code_num_words": 165, "qsc_code_num_chars": 1204.0, "qsc_code_mean_word_length": 5.2969697, "qsc_code_frac_words_unique": 0.66060606, "qsc_code_frac_chars_top_2grams": 0.03775744, "qsc_code_frac_chars_top_3grams": 0.04462243, "qsc_code_frac_chars_top_4grams": 0.06521739, "qsc_code_frac_chars_dupe_5grams": 0.09382151, "qsc_code_frac_chars_dupe_6grams": 0.06407323, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.02051282, "qsc_code_frac_chars_whitespace": 0.19019934, "qsc_code_size_file_byte": 1204.0, "qsc_code_num_lines": 43.0, "qsc_code_num_chars_line_max": 72.0, "qsc_code_num_chars_line_mean": 28.0, "qsc_code_frac_chars_alphabet": 0.87589744, "qsc_code_frac_chars_comments": 0.6486711, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.11764706, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.17647059, "qsc_codejava_score_lines_no_logic": 0.29411765, "qsc_codejava_frac_words_no_modifier": 0.5, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/AlchemicalCatalyst.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.potions;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.ExoticPotion;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone;
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.utils.Random;
import com.watabou.utils.Reflection;
import java.util.ArrayList;
import java.util.HashMap;
public class AlchemicalCatalyst extends Potion {
{
image = ItemSpriteSheet.POTION_CATALYST;
}
private static HashMap<Class<? extends Potion>, Float> potionChances = new HashMap<>();
static{
potionChances.put(PotionOfHealing.class, 3f);
potionChances.put(PotionOfMindVision.class, 2f);
potionChances.put(PotionOfFrost.class, 2f);
potionChances.put(PotionOfLiquidFlame.class, 2f);
potionChances.put(PotionOfToxicGas.class, 2f);
potionChances.put(PotionOfHaste.class, 2f);
potionChances.put(PotionOfInvisibility.class, 2f);
potionChances.put(PotionOfLevitation.class, 2f);
potionChances.put(PotionOfParalyticGas.class, 2f);
potionChances.put(PotionOfPurity.class, 2f);
potionChances.put(PotionOfExperience.class, 1f);
}
@Override
public void apply(Hero hero) {
Potion p = Reflection.newInstance(Random.chances(potionChances));
p.anonymize();
p.apply(hero);
}
@Override
public void shatter(int cell) {
Potion p = Reflection.newInstance(Random.chances(potionChances));
p.anonymize();
curItem = p;
p.shatter(cell);
}
@Override
public boolean isKnown() {
return true;
}
@Override
public int price() {
return 40 * quantity;
}
public static class Recipe extends com.shatteredpixel.shatteredpixeldungeon.items.Recipe {
@Override
public boolean testIngredients(ArrayList<Item> ingredients) {
boolean potion = false;
boolean secondary = false;
for (Item i : ingredients){
if (i instanceof Plant.Seed || i instanceof Runestone){
secondary = true;
//if it is a regular or exotic potion
} else if (ExoticPotion.regToExo.containsKey(i.getClass())
|| ExoticPotion.regToExo.containsValue(i.getClass())) {
potion = true;
}
}
return potion && secondary;
}
@Override
public int cost(ArrayList<Item> ingredients) {
for (Item i : ingredients){
if (i instanceof Plant.Seed){
return 1;
} else if (i instanceof Runestone){
return 2;
}
}
return 1;
}
@Override
public Item brew(ArrayList<Item> ingredients) {
for (Item i : ingredients){
i.quantity(i.quantity()-1);
}
return sampleOutput(null);
}
@Override
public Item sampleOutput(ArrayList<Item> ingredients) {
return new AlchemicalCatalyst();
}
}
}
| 3,746 | AlchemicalCatalyst | java | en | java | code | {"qsc_code_num_words": 429, "qsc_code_num_chars": 3746.0, "qsc_code_mean_word_length": 6.30769231, "qsc_code_frac_words_unique": 0.39160839, "qsc_code_frac_chars_top_2grams": 0.06504065, "qsc_code_frac_chars_top_3grams": 0.06651885, "qsc_code_frac_chars_top_4grams": 0.07649667, "qsc_code_frac_chars_dupe_5grams": 0.20805617, "qsc_code_frac_chars_dupe_6grams": 0.12305987, "qsc_code_frac_chars_dupe_7grams": 0.10236511, "qsc_code_frac_chars_dupe_8grams": 0.07760532, "qsc_code_frac_chars_dupe_9grams": 0.07760532, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01107853, "qsc_code_frac_chars_whitespace": 0.18072611, "qsc_code_size_file_byte": 3746.0, "qsc_code_num_lines": 131.0, "qsc_code_num_chars_line_max": 92.0, "qsc_code_num_chars_line_mean": 28.59541985, "qsc_code_frac_chars_alphabet": 0.8706419, "qsc_code_frac_chars_comments": 0.21809931, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.19101124, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.1011236, "qsc_codejava_score_lines_no_logic": 0.26966292, "qsc_codejava_frac_words_no_modifier": 0.8, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 1 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfLiquidFlame.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.potions;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.PathFinder;
public class PotionOfLiquidFlame extends Potion {
{
initials = 6;
}
@Override
public void shatter( int cell ) {
if (Dungeon.level.heroFOV[cell]) {
setKnown();
splash( cell );
Sample.INSTANCE.play( Assets.SND_SHATTER );
}
for (int offset : PathFinder.NEIGHBOURS9){
if (!Dungeon.level.solid[cell+offset]) {
GameScene.add(Blob.seed(cell + offset, 2, Fire.class));
}
}
}
@Override
public int price() {
return isKnown() ? 30 * quantity : super.price();
}
}
| 1,737 | PotionOfLiquidFlame | java | en | java | code | {"qsc_code_num_words": 225, "qsc_code_num_chars": 1737.0, "qsc_code_mean_word_length": 5.74222222, "qsc_code_frac_words_unique": 0.56888889, "qsc_code_frac_chars_top_2grams": 0.04876161, "qsc_code_frac_chars_top_3grams": 0.17647059, "qsc_code_frac_chars_top_4grams": 0.17027864, "qsc_code_frac_chars_dupe_5grams": 0.14860681, "qsc_code_frac_chars_dupe_6grams": 0.12848297, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01513067, "qsc_code_frac_chars_whitespace": 0.16292458, "qsc_code_size_file_byte": 1737.0, "qsc_code_num_lines": 60.0, "qsc_code_num_chars_line_max": 72.0, "qsc_code_num_chars_line_mean": 28.95, "qsc_code_frac_chars_alphabet": 0.87345254, "qsc_code_frac_chars_comments": 0.44962579, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.06666667, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.1, "qsc_codejava_score_lines_no_logic": 0.36666667, "qsc_codejava_frac_words_no_modifier": 0.5, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfInvisibility.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.potions;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
public class PotionOfInvisibility extends Potion {
{
initials = 4;
}
@Override
public void apply( Hero hero ) {
setKnown();
Buff.affect( hero, Invisibility.class, Invisibility.DURATION );
GLog.i( Messages.get(this, "invisible") );
Sample.INSTANCE.play( Assets.SND_MELD );
}
@Override
public int price() {
return isKnown() ? 40 * quantity : super.price();
}
}
| 1,662 | PotionOfInvisibility | java | en | java | code | {"qsc_code_num_words": 214, "qsc_code_num_chars": 1662.0, "qsc_code_mean_word_length": 5.93457944, "qsc_code_frac_words_unique": 0.57943925, "qsc_code_frac_chars_top_2grams": 0.09370079, "qsc_code_frac_chars_top_3grams": 0.20944882, "qsc_code_frac_chars_top_4grams": 0.20787402, "qsc_code_frac_chars_dupe_5grams": 0.19055118, "qsc_code_frac_chars_dupe_6grams": 0.13070866, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01413428, "qsc_code_frac_chars_whitespace": 0.14861613, "qsc_code_size_file_byte": 1662.0, "qsc_code_num_lines": 50.0, "qsc_code_num_chars_line_max": 75.0, "qsc_code_num_chars_line_mean": 33.24, "qsc_code_frac_chars_alphabet": 0.88339223, "qsc_code_frac_chars_comments": 0.46991576, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.08333333, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.01021566, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.125, "qsc_codejava_score_lines_no_logic": 0.45833333, "qsc_codejava_frac_words_no_modifier": 0.5, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfStrength.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.potions;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
public class PotionOfStrength extends Potion {
{
initials = 10;
}
@Override
public void apply( Hero hero ) {
setKnown();
hero.STR++;
hero.sprite.showStatus( CharSprite.POSITIVE, Messages.get(this, "msg_1") );
GLog.p( Messages.get(this, "msg_2") );
Badges.validateStrengthAttained();
}
@Override
public int price() {
return isKnown() ? 50 * quantity : super.price();
}
}
| 1,567 | PotionOfStrength | java | en | java | code | {"qsc_code_num_words": 202, "qsc_code_num_chars": 1567.0, "qsc_code_mean_word_length": 5.82673267, "qsc_code_frac_words_unique": 0.59405941, "qsc_code_frac_chars_top_2grams": 0.086661, "qsc_code_frac_chars_top_3grams": 0.19371283, "qsc_code_frac_chars_top_4grams": 0.18691589, "qsc_code_frac_chars_dupe_5grams": 0.06966865, "qsc_code_frac_chars_dupe_6grams": 0.04757859, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01745068, "qsc_code_frac_chars_whitespace": 0.15890236, "qsc_code_size_file_byte": 1567.0, "qsc_code_num_lines": 50.0, "qsc_code_num_chars_line_max": 78.0, "qsc_code_num_chars_line_mean": 31.34, "qsc_code_frac_chars_alphabet": 0.87556904, "qsc_code_frac_chars_comments": 0.49840459, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.08695652, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.01272265, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.13043478, "qsc_codejava_score_lines_no_logic": 0.39130435, "qsc_codejava_frac_words_no_modifier": 0.5, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfPurity.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.potions;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.BlobImmunity;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.PathFinder;
import java.util.ArrayList;
public class PotionOfPurity extends Potion {
private static final int DISTANCE = 3;
private static ArrayList<Class> affectedBlobs;
{
initials = 9;
affectedBlobs = new ArrayList<>(new BlobImmunity().immunities());
}
@Override
public void shatter( int cell ) {
PathFinder.buildDistanceMap( cell, BArray.not( Dungeon.level.solid, null ), DISTANCE );
ArrayList<Blob> blobs = new ArrayList<>();
for (Class c : affectedBlobs){
Blob b = Dungeon.level.blobs.get(c);
if (b != null && b.volume > 0){
blobs.add(b);
}
}
for (int i=0; i < Dungeon.level.length(); i++) {
if (PathFinder.distance[i] < Integer.MAX_VALUE) {
for (Blob blob : blobs) {
int value = blob.cur[i];
if (value > 0) {
blob.clear(i);
blob.cur[i] = 0;
blob.volume -= value;
}
}
if (Dungeon.level.heroFOV[i]) {
CellEmitter.get( i ).burst( Speck.factory( Speck.DISCOVER ), 2 );
}
}
}
if (Dungeon.level.heroFOV[cell]) {
splash(cell);
Sample.INSTANCE.play(Assets.SND_SHATTER);
setKnown();
GLog.i(Messages.get(this, "freshness"));
}
}
@Override
public void apply( Hero hero ) {
GLog.w( Messages.get(this, "protected") );
Buff.prolong( hero, BlobImmunity.class, BlobImmunity.DURATION );
setKnown();
}
@Override
public int price() {
return isKnown() ? 40 * quantity : super.price();
}
}
| 3,099 | PotionOfPurity | java | en | java | code | {"qsc_code_num_words": 377, "qsc_code_num_chars": 3099.0, "qsc_code_mean_word_length": 5.84880637, "qsc_code_frac_words_unique": 0.43501326, "qsc_code_frac_chars_top_2grams": 0.05306122, "qsc_code_frac_chars_top_3grams": 0.20680272, "qsc_code_frac_chars_top_4grams": 0.21950113, "qsc_code_frac_chars_dupe_5grams": 0.22312925, "qsc_code_frac_chars_dupe_6grams": 0.07528345, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01021611, "qsc_code_frac_chars_whitespace": 0.17876734, "qsc_code_size_file_byte": 3099.0, "qsc_code_num_lines": 109.0, "qsc_code_num_chars_line_max": 90.0, "qsc_code_num_chars_line_mean": 28.43119266, "qsc_code_frac_chars_alphabet": 0.85618861, "qsc_code_frac_chars_comments": 0.25201678, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.07692308, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00776531, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.06153846, "qsc_codejava_score_lines_no_logic": 0.30769231, "qsc_codejava_frac_words_no_modifier": 0.6, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/food/ChargrilledMeat.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.food;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class ChargrilledMeat extends Food {
{
image = ItemSpriteSheet.STEAK;
energy = Hunger.HUNGRY/2f;
}
@Override
public int price() {
return 8 * quantity;
}
public static Food cook( MysteryMeat ingredient ) {
ChargrilledMeat result = new ChargrilledMeat();
result.quantity = ingredient.quantity();
return result;
}
}
| 1,331 | ChargrilledMeat | java | en | java | code | {"qsc_code_num_words": 175, "qsc_code_num_chars": 1331.0, "qsc_code_mean_word_length": 5.71428571, "qsc_code_frac_words_unique": 0.62857143, "qsc_code_frac_chars_top_2grams": 0.033, "qsc_code_frac_chars_top_3grams": 0.039, "qsc_code_frac_chars_top_4grams": 0.057, "qsc_code_frac_chars_dupe_5grams": 0.082, "qsc_code_frac_chars_dupe_6grams": 0.056, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01728844, "qsc_code_frac_chars_whitespace": 0.17430503, "qsc_code_size_file_byte": 1331.0, "qsc_code_num_lines": 43.0, "qsc_code_num_chars_line_max": 73.0, "qsc_code_num_chars_line_mean": 30.95348837, "qsc_code_frac_chars_alphabet": 0.89262966, "qsc_code_frac_chars_comments": 0.58677686, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.0, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.11111111, "qsc_codejava_score_lines_no_logic": 0.33333333, "qsc_codejava_frac_words_no_modifier": 0.66666667, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 1 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/food/Blandfruit.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.food;
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.Recipe;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfExperience;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfFrost;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHaste;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfInvisibility;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLevitation;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLiquidFlame;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMindVision;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfParalyticGas;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfPurity;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfToxicGas;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant.Seed;
import com.shatteredpixel.shatteredpixeldungeon.plants.Sungrass;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.utils.Bundle;
import com.watabou.utils.Reflection;
import java.util.ArrayList;
public class Blandfruit extends Food {
public Potion potionAttrib = null;
public ItemSprite.Glowing potionGlow = null;
{
stackable = true;
image = ItemSpriteSheet.BLANDFRUIT;
//only applies when blandfruit is cooked
energy = Hunger.STARVING;
bones = true;
}
@Override
public boolean isSimilar( Item item ) {
if ( super.isSimilar(item) ){
Blandfruit other = (Blandfruit) item;
if (potionAttrib == null && other.potionAttrib == null) {
return true;
} else if (potionAttrib != null && other.potionAttrib != null
&& potionAttrib.isSimilar(other.potionAttrib)){
return true;
}
}
return false;
}
@Override
public void execute( Hero hero, String action ) {
if (action.equals( AC_EAT ) && potionAttrib == null) {
GLog.w( Messages.get(this, "raw"));
return;
}
super.execute(hero, action);
if (action.equals( AC_EAT ) && potionAttrib != null){
potionAttrib.apply(hero);
}
}
@Override
public String desc() {
if (potionAttrib== null) {
return super.desc();
} else {
String desc = Messages.get(this, "desc_cooked") + "\n\n";
if (potionAttrib instanceof PotionOfFrost
|| potionAttrib instanceof PotionOfLiquidFlame
|| potionAttrib instanceof PotionOfToxicGas
|| potionAttrib instanceof PotionOfParalyticGas) {
desc += Messages.get(this, "desc_throw");
} else {
desc += Messages.get(this, "desc_eat");
}
return desc;
}
}
@Override
public int price() {
return 20 * quantity;
}
public Item cook(Seed seed){
return imbuePotion(Reflection.newInstance(Potion.SeedToPotion.types.get(seed.getClass())));
}
public Item imbuePotion(Potion potion){
potionAttrib = potion;
potionAttrib.anonymize();
potionAttrib.image = ItemSpriteSheet.BLANDFRUIT;
if (potionAttrib instanceof PotionOfHealing){
name = Messages.get(this, "sunfruit");
potionGlow = new ItemSprite.Glowing( 0x2EE62E );
} else if (potionAttrib instanceof PotionOfStrength){
name = Messages.get(this, "rotfruit");
potionGlow = new ItemSprite.Glowing( 0xCC0022 );
} else if (potionAttrib instanceof PotionOfParalyticGas){
name = Messages.get(this, "earthfruit");
potionGlow = new ItemSprite.Glowing( 0x67583D );
} else if (potionAttrib instanceof PotionOfInvisibility){
name = Messages.get(this, "blindfruit");
potionGlow = new ItemSprite.Glowing( 0xD9D9D9 );
} else if (potionAttrib instanceof PotionOfLiquidFlame){
name = Messages.get(this, "firefruit");
potionGlow = new ItemSprite.Glowing( 0xFF7F00 );
} else if (potionAttrib instanceof PotionOfFrost){
name = Messages.get(this, "icefruit");
potionGlow = new ItemSprite.Glowing( 0x66B3FF );
} else if (potionAttrib instanceof PotionOfMindVision){
name = Messages.get(this, "fadefruit");
potionGlow = new ItemSprite.Glowing( 0x919999 );
} else if (potionAttrib instanceof PotionOfToxicGas){
name = Messages.get(this, "sorrowfruit");
potionGlow = new ItemSprite.Glowing( 0xA15CE5 );
} else if (potionAttrib instanceof PotionOfLevitation) {
name = Messages.get(this, "stormfruit");
potionGlow = new ItemSprite.Glowing( 0x1B5F79 );
} else if (potionAttrib instanceof PotionOfPurity) {
name = Messages.get(this, "dreamfruit");
potionGlow = new ItemSprite.Glowing( 0xC152AA );
} else if (potionAttrib instanceof PotionOfExperience) {
name = Messages.get(this, "starfruit");
potionGlow = new ItemSprite.Glowing( 0x404040 );
} else if (potionAttrib instanceof PotionOfHaste) {
name = Messages.get(this, "swiftfruit");
potionGlow = new ItemSprite.Glowing( 0xCCBB00 );
}
return this;
}
public static final String POTIONATTRIB = "potionattrib";
@Override
protected void onThrow(int cell) {
if (Dungeon.level.map[cell] == Terrain.WELL || Dungeon.level.pit[cell]) {
super.onThrow( cell );
} else if (potionAttrib instanceof PotionOfLiquidFlame ||
potionAttrib instanceof PotionOfToxicGas ||
potionAttrib instanceof PotionOfParalyticGas ||
potionAttrib instanceof PotionOfFrost ||
potionAttrib instanceof PotionOfLevitation ||
potionAttrib instanceof PotionOfPurity) {
potionAttrib.shatter( cell );
Dungeon.level.drop(new Chunks(), cell).sprite.drop();
} else {
super.onThrow( cell );
}
}
@Override
public void reset() {
if (potionAttrib != null)
imbuePotion(potionAttrib);
else
super.reset();
}
@Override
public void storeInBundle(Bundle bundle){
super.storeInBundle(bundle);
bundle.put( POTIONATTRIB , potionAttrib);
}
@Override
public void restoreFromBundle(Bundle bundle) {
super.restoreFromBundle(bundle);
if (bundle.contains(POTIONATTRIB)) {
imbuePotion((Potion) bundle.get(POTIONATTRIB));
}
}
@Override
public ItemSprite.Glowing glowing() {
return potionGlow;
}
public static class CookFruit extends Recipe {
@Override
//also sorts ingredients if it can
public boolean testIngredients(ArrayList<Item> ingredients) {
if (ingredients.size() != 2) return false;
if (ingredients.get(0) instanceof Blandfruit){
if (!(ingredients.get(1) instanceof Seed)){
return false;
}
} else if (ingredients.get(0) instanceof Seed){
if (ingredients.get(1) instanceof Blandfruit){
Item temp = ingredients.get(0);
ingredients.set(0, ingredients.get(1));
ingredients.set(1, temp);
} else {
return false;
}
} else {
return false;
}
Blandfruit fruit = (Blandfruit) ingredients.get(0);
Seed seed = (Seed) ingredients.get(1);
if (fruit.quantity() >= 1 && fruit.potionAttrib == null
&& seed.quantity() >= 1){
if (Dungeon.isChallenged(Challenges.NO_HEALING)
&& seed instanceof Sungrass.Seed){
return false;
}
return true;
}
return false;
}
@Override
public int cost(ArrayList<Item> ingredients) {
return 3;
}
@Override
public Item brew(ArrayList<Item> ingredients) {
if (!testIngredients(ingredients)) return null;
ingredients.get(0).quantity(ingredients.get(0).quantity() - 1);
ingredients.get(1).quantity(ingredients.get(1).quantity() - 1);
return new Blandfruit().cook((Seed) ingredients.get(1));
}
@Override
public Item sampleOutput(ArrayList<Item> ingredients) {
if (!testIngredients(ingredients)) return null;
return new Blandfruit().cook((Seed) ingredients.get(1));
}
}
public static class Chunks extends Food {
{
stackable = true;
image = ItemSpriteSheet.BLAND_CHUNKS;
energy = Hunger.STARVING;
bones = true;
}
}
}
| 9,379 | Blandfruit | java | en | java | code | {"qsc_code_num_words": 984, "qsc_code_num_chars": 9379.0, "qsc_code_mean_word_length": 7.0203252, "qsc_code_frac_words_unique": 0.24186992, "qsc_code_frac_chars_top_2grams": 0.03647944, "qsc_code_frac_chars_top_3grams": 0.14852345, "qsc_code_frac_chars_top_4grams": 0.1656051, "qsc_code_frac_chars_dupe_5grams": 0.32860452, "qsc_code_frac_chars_dupe_6grams": 0.2119282, "qsc_code_frac_chars_dupe_7grams": 0.07701216, "qsc_code_frac_chars_dupe_8grams": 0.07701216, "qsc_code_frac_chars_dupe_9grams": 0.03503185, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01241292, "qsc_code_frac_chars_whitespace": 0.15822582, "qsc_code_size_file_byte": 9379.0, "qsc_code_num_lines": 303.0, "qsc_code_num_chars_line_max": 94.0, "qsc_code_num_chars_line_mean": 30.95379538, "qsc_code_frac_chars_alphabet": 0.86257125, "qsc_code_frac_chars_comments": 0.0911611, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.17180617, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.01877053, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.01126232, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.0660793, "qsc_codejava_score_lines_no_logic": 0.25991189, "qsc_codejava_frac_words_no_modifier": 0.875, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfShock.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.stones;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Lightning;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.EnergyParticle;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.SparkParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.PathFinder;
import java.util.ArrayList;
public class StoneOfShock extends Runestone {
{
image = ItemSpriteSheet.STONE_SHOCK;
}
@Override
protected void activate(int cell) {
Sample.INSTANCE.play( Assets.SND_LIGHTNING );
ArrayList<Lightning.Arc> arcs = new ArrayList<>();
int hits = 0;
PathFinder.buildDistanceMap( cell, BArray.not( Dungeon.level.solid, null ), 2 );
for (int i = 0; i < PathFinder.distance.length; i++) {
if (PathFinder.distance[i] < Integer.MAX_VALUE) {
Char n = Actor.findChar(i);
if (n != null) {
arcs.add(new Lightning.Arc(cell, n.sprite.center()));
Buff.prolong(n, Paralysis.class, 1f);
hits++;
}
}
}
CellEmitter.center( cell ).burst( SparkParticle.FACTORY, 3 );
if (hits > 0) {
curUser.sprite.parent.addToFront( new Lightning( arcs, null ) );
curUser.sprite.centerEmitter().burst(EnergyParticle.FACTORY, 10);
Sample.INSTANCE.play( Assets.SND_LIGHTNING );
curUser.belongings.charge(1f + hits);
}
}
}
| 2,808 | StoneOfShock | java | en | java | code | {"qsc_code_num_words": 339, "qsc_code_num_chars": 2808.0, "qsc_code_mean_word_length": 6.31563422, "qsc_code_frac_words_unique": 0.4660767, "qsc_code_frac_chars_top_2grams": 0.06305465, "qsc_code_frac_chars_top_3grams": 0.24848202, "qsc_code_frac_chars_top_4grams": 0.26716488, "qsc_code_frac_chars_dupe_5grams": 0.31947688, "qsc_code_frac_chars_dupe_6grams": 0.16721158, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.0107438, "qsc_code_frac_chars_whitespace": 0.13817664, "qsc_code_size_file_byte": 2808.0, "qsc_code_num_lines": 79.0, "qsc_code_num_chars_line_max": 83.0, "qsc_code_num_chars_line_mean": 35.5443038, "qsc_code_frac_chars_alphabet": 0.87396694, "qsc_code_frac_chars_comments": 0.27777778, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.04347826, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.02173913, "qsc_codejava_score_lines_no_logic": 0.39130435, "qsc_codejava_frac_words_no_modifier": 0.5, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/stones/Runestone.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.stones;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public abstract class Runestone extends Item {
{
stackable = true;
defaultAction = AC_THROW;
}
@Override
protected void onThrow(int cell) {
if (Dungeon.level.pit[cell] || !defaultAction.equals(AC_THROW)){
super.onThrow( cell );
} else {
activate(cell);
}
}
protected abstract void activate(int cell);
@Override
public boolean isUpgradable() {
return false;
}
@Override
public boolean isIdentified() {
return true;
}
@Override
public int price() {
return 10 * quantity;
}
public static class PlaceHolder extends Runestone {
{
image = ItemSpriteSheet.STONE_HOLDER;
}
@Override
protected void activate(int cell) {
//does nothing
}
@Override
public boolean isSimilar(Item item) {
return item instanceof Runestone;
}
@Override
public String info() {
return "";
}
}
}
| 1,899 | Runestone | java | en | java | code | {"qsc_code_num_words": 234, "qsc_code_num_chars": 1899.0, "qsc_code_mean_word_length": 5.84615385, "qsc_code_frac_words_unique": 0.54700855, "qsc_code_frac_chars_top_2grams": 0.05116959, "qsc_code_frac_chars_top_3grams": 0.11111111, "qsc_code_frac_chars_top_4grams": 0.04166667, "qsc_code_frac_chars_dupe_5grams": 0.05994152, "qsc_code_frac_chars_dupe_6grams": 0.04093567, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01245085, "qsc_code_frac_chars_whitespace": 0.19641917, "qsc_code_size_file_byte": 1899.0, "qsc_code_num_lines": 82.0, "qsc_code_num_chars_line_max": 73.0, "qsc_code_num_chars_line_mean": 23.15853659, "qsc_code_frac_chars_alphabet": 0.88401048, "qsc_code_frac_chars_comments": 0.41864139, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.14893617, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.14893617, "qsc_codejava_score_lines_no_logic": 0.29787234, "qsc_codejava_frac_words_no_modifier": 0.875, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfAggression.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.stones;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FlavourBuff;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Bundle;
public class StoneOfAggression extends Runestone {
{
image = ItemSpriteSheet.STONE_AGGRESSION;
}
@Override
protected void activate(int cell) {
Char ch = Actor.findChar( cell );
if (ch != null) {
if (ch.alignment == Char.Alignment.ENEMY) {
Buff.prolong(ch, Aggression.class, Aggression.DURATION / 5f);
} else {
Buff.prolong(ch, Aggression.class, Aggression.DURATION);
}
CellEmitter.center(cell).start( Speck.factory( Speck.SCREAM ), 0.3f, 3 );
Sample.INSTANCE.play( Assets.SND_READ );
} else {
//Item.onThrow
Heap heap = Dungeon.level.drop( this, cell );
if (!heap.isEmpty()) {
heap.sprite.drop( cell );
}
}
}
public static class Aggression extends FlavourBuff {
public static final float DURATION = 20f;
{
type = buffType.NEGATIVE;
announced = true;
}
@Override
public void storeInBundle( Bundle bundle ) {
super.storeInBundle(bundle);
}
@Override
public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle( bundle );
}
@Override
public void detach() {
//if our target is an enemy, reset the aggro of any enemies targeting it
if (target.isAlive()) {
if (target.alignment == Char.Alignment.ENEMY) {
for (Mob m : Dungeon.level.mobs) {
if (m.alignment == Char.Alignment.ENEMY && m.isTargeting(target)) {
m.aggro(null);
}
}
}
}
super.detach();
}
@Override
public String toString() {
return Messages.get(this, "name");
}
}
}
| 3,291 | StoneOfAggression | java | en | java | code | {"qsc_code_num_words": 388, "qsc_code_num_chars": 3291.0, "qsc_code_mean_word_length": 6.20876289, "qsc_code_frac_words_unique": 0.44587629, "qsc_code_frac_chars_top_2grams": 0.05603985, "qsc_code_frac_chars_top_3grams": 0.22083852, "qsc_code_frac_chars_top_4grams": 0.23744292, "qsc_code_frac_chars_dupe_5grams": 0.28601079, "qsc_code_frac_chars_dupe_6grams": 0.10709838, "qsc_code_frac_chars_dupe_7grams": 0.03819012, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00841874, "qsc_code_frac_chars_whitespace": 0.16985719, "qsc_code_size_file_byte": 3291.0, "qsc_code_num_lines": 111.0, "qsc_code_num_chars_line_max": 77.0, "qsc_code_num_chars_line_mean": 29.64864865, "qsc_code_frac_chars_alphabet": 0.87335286, "qsc_code_frac_chars_comments": 0.2631419, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.09859155, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00164948, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.07042254, "qsc_codejava_score_lines_no_logic": 0.29577465, "qsc_codejava_frac_words_no_modifier": 0.83333333, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfBlast.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.stones;
import com.shatteredpixel.shatteredpixeldungeon.items.bombs.Bomb;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class StoneOfBlast extends Runestone {
{
image = ItemSpriteSheet.STONE_BLAST;
}
@Override
protected void activate(int cell) {
new Bomb().explode(cell);
}
}
| 1,236 | StoneOfBlast | java | en | java | code | {"qsc_code_num_words": 166, "qsc_code_num_chars": 1236.0, "qsc_code_mean_word_length": 5.68072289, "qsc_code_frac_words_unique": 0.62650602, "qsc_code_frac_chars_top_2grams": 0.07211029, "qsc_code_frac_chars_top_3grams": 0.1611877, "qsc_code_frac_chars_top_4grams": 0.06044539, "qsc_code_frac_chars_dupe_5grams": 0.24920467, "qsc_code_frac_chars_dupe_6grams": 0.05938494, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01644101, "qsc_code_frac_chars_whitespace": 0.16343042, "qsc_code_size_file_byte": 1236.0, "qsc_code_num_lines": 39.0, "qsc_code_num_chars_line_max": 73.0, "qsc_code_num_chars_line_mean": 31.69230769, "qsc_code_frac_chars_alphabet": 0.89555126, "qsc_code_frac_chars_comments": 0.63106796, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.0, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.15384615, "qsc_codejava_score_lines_no_logic": 0.46153846, "qsc_codejava_frac_words_no_modifier": 0.33333333, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfDeepenedSleep.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.stones;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicalSleep;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.PathFinder;
public class StoneOfDeepenedSleep extends Runestone {
{
image = ItemSpriteSheet.STONE_SLEEP;
}
@Override
protected void activate(int cell) {
for (int i : PathFinder.NEIGHBOURS9){
CellEmitter.get(cell + i).start( Speck.factory( Speck.NOTE ), 0.1f, 2 );
if (Actor.findChar(cell + i) != null) {
Char c = Actor.findChar(cell + i);
if ((c instanceof Mob && ((Mob) c).state == ((Mob) c).SLEEPING)){
Buff.affect(c, MagicalSleep.class);
}
}
}
Sample.INSTANCE.play( Assets.SND_LULLABY );
}
}
| 2,156 | StoneOfDeepenedSleep | java | en | java | code | {"qsc_code_num_words": 266, "qsc_code_num_chars": 2156.0, "qsc_code_mean_word_length": 6.09398496, "qsc_code_frac_words_unique": 0.51503759, "qsc_code_frac_chars_top_2grams": 0.06662554, "qsc_code_frac_chars_top_3grams": 0.25786552, "qsc_code_frac_chars_top_4grams": 0.27143738, "qsc_code_frac_chars_dupe_5grams": 0.33436151, "qsc_code_frac_chars_dupe_6grams": 0.10240592, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01153213, "qsc_code_frac_chars_whitespace": 0.15538033, "qsc_code_size_file_byte": 2156.0, "qsc_code_num_lines": 66.0, "qsc_code_num_chars_line_max": 76.0, "qsc_code_num_chars_line_mean": 32.66666667, "qsc_code_frac_chars_alphabet": 0.87863811, "qsc_code_frac_chars_comments": 0.36178108, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.0, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.03225806, "qsc_codejava_score_lines_no_logic": 0.4516129, "qsc_codejava_frac_words_no_modifier": 0.5, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfIntuition.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.stones;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.effects.Identification;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfExperience;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfFrost;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHaste;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfInvisibility;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLevitation;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLiquidFlame;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMindVision;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfParalyticGas;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfPurity;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfToxicGas;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.ExoticPotion;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfIdentify;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfLullaby;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicMapping;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMirrorImage;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRage;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRemoveCurse;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRetribution;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTerror;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTransmutation;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ExoticScroll;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.ui.IconButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.windows.IconTitle;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
import com.watabou.noosa.Image;
import java.util.HashSet;
public class StoneOfIntuition extends InventoryStone {
{
mode = WndBag.Mode.UNIDED_POTION_OR_SCROLL;
image = ItemSpriteSheet.STONE_INTUITION;
}
@Override
protected void onItemSelected(Item item) {
GameScene.show( new WndGuess(item));
}
//in order of their consumable icon
public static Class[] potions = new Class[]{
PotionOfExperience.class,
PotionOfFrost.class,
PotionOfHaste.class,
PotionOfHealing.class,
PotionOfInvisibility.class,
PotionOfLevitation.class,
PotionOfLiquidFlame.class,
PotionOfMindVision.class,
PotionOfParalyticGas.class,
PotionOfPurity.class,
PotionOfStrength.class,
PotionOfToxicGas.class
};
public static Class[] scrolls = new Class[]{
ScrollOfIdentify.class,
ScrollOfLullaby.class,
ScrollOfMagicMapping.class,
ScrollOfMirrorImage.class,
ScrollOfRetribution.class,
ScrollOfRage.class,
ScrollOfRecharging.class,
ScrollOfRemoveCurse.class,
ScrollOfTeleportation.class,
ScrollOfTerror.class,
ScrollOfTransmutation.class,
ScrollOfUpgrade.class
};
static Class curGuess = null;
public class WndGuess extends Window {
private static final int WIDTH = 120;
private static final int BTN_SIZE = 20;
public WndGuess(final Item item){
IconTitle titlebar = new IconTitle();
titlebar.icon( new ItemSprite(ItemSpriteSheet.STONE_INTUITION, null) );
titlebar.label( Messages.get(StoneOfIntuition.class, "name") );
titlebar.setRect( 0, 0, WIDTH, 0 );
add( titlebar );
RenderedTextBlock text = PixelScene.renderTextBlock(6);
text.text( Messages.get(this, "text") );
text.setPos(0, titlebar.bottom());
text.maxWidth( WIDTH );
add(text);
final RedButton guess = new RedButton(""){
@Override
protected void onClick() {
super.onClick();
useAnimation();
if (item.getClass() == curGuess){
item.identify();
GLog.p( Messages.get(WndGuess.class, "correct") );
curUser.sprite.parent.add( new Identification( curUser.sprite.center().offset( 0, -16 ) ) );
} else {
GLog.n( Messages.get(WndGuess.class, "incorrect") );
}
curGuess = null;
hide();
}
};
guess.visible = false;
guess.icon( new ItemSprite(item) );
guess.enable(false);
guess.setRect(0, 80, WIDTH, 20);
add(guess);
float left;
float top = text.bottom() + 5;
int rows;
int placed = 0;
HashSet<Class<?extends Item>> unIDed = new HashSet<>();
final Class[] all;
final int row;
if (item.isIdentified()){
hide();
return;
} else if (item instanceof Potion){
unIDed.addAll(Potion.getUnknown());
all = potions.clone();
if (item instanceof ExoticPotion){
row = 8;
for (int i = 0; i < all.length; i++){
all[i] = ExoticPotion.regToExo.get(all[i]);
}
HashSet<Class<?extends Item>> exoUID = new HashSet<>();
for (Class<?extends Item> i : unIDed){
exoUID.add(ExoticPotion.regToExo.get(i));
}
unIDed = exoUID;
} else {
row = 0;
}
} else if (item instanceof Scroll){
unIDed.addAll(Scroll.getUnknown());
all = scrolls.clone();
if (item instanceof ExoticScroll){
row = 24;
for (int i = 0; i < all.length; i++){
all[i] = ExoticScroll.regToExo.get(all[i]);
}
HashSet<Class<?extends Item>> exoUID = new HashSet<>();
for (Class<?extends Item> i : unIDed){
exoUID.add(ExoticScroll.regToExo.get(i));
}
unIDed = exoUID;
} else {
row = 16;
}
} else {
hide();
return;
}
if (unIDed.size() < 6){
rows = 1;
top += BTN_SIZE/2f;
left = (WIDTH - BTN_SIZE*unIDed.size())/2f;
} else {
rows = 2;
left = (WIDTH - BTN_SIZE*((unIDed.size()+1)/2))/2f;
}
for (int i = 0; i < all.length; i++){
if (!unIDed.contains(all[i])) {
continue;
}
final int j = i;
IconButton btn = new IconButton(){
@Override
protected void onClick() {
curGuess = all[j];
guess.visible = true;
guess.text( Messages.get(curGuess, "name") );
guess.enable(true);
super.onClick();
}
};
Image im = new Image(Assets.CONS_ICONS, 7*i, row, 7, 8);
im.scale.set(2f);
btn.icon(im);
btn.setRect(left + placed*BTN_SIZE, top, BTN_SIZE, BTN_SIZE);
add(btn);
placed++;
if (rows == 2 && placed == ((unIDed.size()+1)/2)){
placed = 0;
if (unIDed.size() % 2 == 1){
left += BTN_SIZE/2f;
}
top += BTN_SIZE;
}
}
resize(WIDTH, 100);
}
@Override
public void onBackPressed() {
super.onBackPressed();
new StoneOfIntuition().collect();
}
}
}
| 8,809 | StoneOfIntuition | java | en | java | code | {"qsc_code_num_words": 944, "qsc_code_num_chars": 8809.0, "qsc_code_mean_word_length": 6.8220339, "qsc_code_frac_words_unique": 0.2595339, "qsc_code_frac_chars_top_2grams": 0.11614907, "qsc_code_frac_chars_top_3grams": 0.25962733, "qsc_code_frac_chars_top_4grams": 0.29378882, "qsc_code_frac_chars_dupe_5grams": 0.39503106, "qsc_code_frac_chars_dupe_6grams": 0.3076087, "qsc_code_frac_chars_dupe_7grams": 0.04736025, "qsc_code_frac_chars_dupe_8grams": 0.03773292, "qsc_code_frac_chars_dupe_9grams": 0.03478261, "qsc_code_frac_chars_dupe_10grams": 0.03478261, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00917307, "qsc_code_frac_chars_whitespace": 0.15847429, "qsc_code_size_file_byte": 8809.0, "qsc_code_num_lines": 261.0, "qsc_code_num_chars_line_max": 99.0, "qsc_code_num_chars_line_mean": 33.75095785, "qsc_code_frac_chars_alphabet": 0.85957102, "qsc_code_frac_chars_comments": 0.09263253, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.14691943, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00350307, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.02369668, "qsc_codejava_score_lines_no_logic": 0.27014218, "qsc_codejava_frac_words_no_modifier": 0.57142857, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/ClassArmor.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.armor;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.BrokenSeal;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.utils.Bundle;
import java.util.ArrayList;
abstract public class ClassArmor extends Armor {
private static final String AC_SPECIAL = "SPECIAL";
{
levelKnown = true;
cursedKnown = true;
defaultAction = AC_SPECIAL;
bones = false;
}
private int armorTier;
public ClassArmor() {
super( 6 );
}
public static ClassArmor upgrade ( Hero owner, Armor armor ) {
ClassArmor classArmor = null;
switch (owner.heroClass) {
case WARRIOR:
classArmor = new WarriorArmor();
BrokenSeal seal = armor.checkSeal();
if (seal != null) {
classArmor.affixSeal(seal);
}
break;
case ROGUE:
classArmor = new RogueArmor();
break;
case MAGE:
classArmor = new MageArmor();
break;
case HUNTRESS:
classArmor = new HuntressArmor();
break;
}
classArmor.level(armor.level() - (armor.curseInfusionBonus ? 1 : 0));
classArmor.armorTier = armor.tier;
classArmor.augment = armor.augment;
classArmor.inscribe( armor.glyph );
classArmor.cursed = armor.cursed;
classArmor.curseInfusionBonus = armor.curseInfusionBonus;
classArmor.identify();
return classArmor;
}
private static final String ARMOR_TIER = "armortier";
@Override
public void storeInBundle( Bundle bundle ) {
super.storeInBundle( bundle );
bundle.put( ARMOR_TIER, armorTier );
}
@Override
public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle( bundle );
armorTier = bundle.getInt( ARMOR_TIER );
}
@Override
public ArrayList<String> actions( Hero hero ) {
ArrayList<String> actions = super.actions( hero );
if (hero.HP >= 3 && isEquipped( hero )) {
actions.add( AC_SPECIAL );
}
return actions;
}
@Override
public void execute( Hero hero, String action ) {
super.execute( hero, action );
if (action.equals(AC_SPECIAL)) {
if (hero.HP < 3) {
GLog.w( Messages.get(this, "low_hp") );
} else if (!isEquipped( hero )) {
GLog.w( Messages.get(this, "not_equipped") );
} else {
curUser = hero;
Invisibility.dispel();
doSpecial();
}
}
}
abstract public void doSpecial();
@Override
public int STRReq(int lvl) {
lvl = Math.max(0, lvl);
//strength req decreases at +1,+3,+6,+10,etc.
return (8 + Math.round(armorTier * 2)) - (int)(Math.sqrt(8 * lvl + 1) - 1)/2;
}
@Override
public int DRMax(int lvl){
int max = armorTier * (2 + lvl) + augment.defenseFactor(lvl);
if (lvl > max){
return ((lvl - max)+1)/2;
} else {
return max;
}
}
@Override
public boolean isIdentified() {
return true;
}
@Override
public int price() {
return 0;
}
}
| 3,795 | ClassArmor | java | en | java | code | {"qsc_code_num_words": 457, "qsc_code_num_chars": 3795.0, "qsc_code_mean_word_length": 5.76148796, "qsc_code_frac_words_unique": 0.40919037, "qsc_code_frac_chars_top_2grams": 0.04253703, "qsc_code_frac_chars_top_3grams": 0.08659324, "qsc_code_frac_chars_top_4grams": 0.08355488, "qsc_code_frac_chars_dupe_5grams": 0.1116597, "qsc_code_frac_chars_dupe_6grams": 0.04861375, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01243049, "qsc_code_frac_chars_whitespace": 0.1944664, "qsc_code_size_file_byte": 3795.0, "qsc_code_num_lines": 158.0, "qsc_code_num_chars_line_max": 80.0, "qsc_code_num_chars_line_mean": 24.01898734, "qsc_code_frac_chars_alphabet": 0.84887144, "qsc_code_frac_chars_comments": 0.21765481, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.13084112, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.01145167, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.07476636, "qsc_codejava_score_lines_no_logic": 0.19626168, "qsc_codejava_frac_words_no_modifier": 1.0, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": null, "qsc_codejava_frac_lines_print": 0.0} | 1 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/bags/MagicalHolster.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.bags;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.bombs.Bomb;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class MagicalHolster extends Bag {
{
image = ItemSpriteSheet.HOLSTER;
size = 20;
}
public static final float HOLSTER_SCALE_FACTOR = 0.85f;
public static final float HOLSTER_DURABILITY_FACTOR = 1.2f;
@Override
public boolean grab( Item item ) {
return item instanceof Wand || item instanceof MissileWeapon || item instanceof Bomb;
}
@Override
public boolean collect( Bag container ) {
if (super.collect( container )) {
if (owner != null) {
for (Item item : items) {
if (item instanceof Wand) {
((Wand) item).charge(owner, HOLSTER_SCALE_FACTOR);
} else if (item instanceof MissileWeapon){
((MissileWeapon) item).holster = true;
}
}
}
return true;
} else {
return false;
}
}
@Override
public void onDetach( ) {
super.onDetach();
for (Item item : items) {
if (item instanceof Wand) {
((Wand)item).stopCharging();
} else if (item instanceof MissileWeapon){
((MissileWeapon) item).holster = false;
}
}
}
@Override
public int price() {
return 60;
}
}
| 2,259 | MagicalHolster | java | en | java | code | {"qsc_code_num_words": 279, "qsc_code_num_chars": 2259.0, "qsc_code_mean_word_length": 5.8172043, "qsc_code_frac_words_unique": 0.47670251, "qsc_code_frac_chars_top_2grams": 0.06038201, "qsc_code_frac_chars_top_3grams": 0.14048059, "qsc_code_frac_chars_top_4grams": 0.13247073, "qsc_code_frac_chars_dupe_5grams": 0.3314849, "qsc_code_frac_chars_dupe_6grams": 0.15896488, "qsc_code_frac_chars_dupe_7grams": 0.12446087, "qsc_code_frac_chars_dupe_8grams": 0.12446087, "qsc_code_frac_chars_dupe_9grams": 0.05422058, "qsc_code_frac_chars_dupe_10grams": 0.05422058, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01419214, "qsc_code_frac_chars_whitespace": 0.18902169, "qsc_code_size_file_byte": 2259.0, "qsc_code_num_lines": 80.0, "qsc_code_num_chars_line_max": 88.0, "qsc_code_num_chars_line_mean": 28.2375, "qsc_code_frac_chars_alphabet": 0.87172489, "qsc_code_frac_chars_comments": 0.3457282, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.2, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.08, "qsc_codejava_score_lines_no_logic": 0.26, "qsc_codejava_frac_words_no_modifier": 0.8, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 1 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/bags/Bag.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.bags;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
import com.watabou.utils.Bundlable;
import com.watabou.utils.Bundle;
import java.util.ArrayList;
import java.util.Iterator;
public class Bag extends Item implements Iterable<Item> {
public static final String AC_OPEN = "OPEN";
{
image = 11;
defaultAction = AC_OPEN;
unique = true;
}
public Char owner;
public ArrayList<Item> items = new ArrayList<>();
public int size = 1;
@Override
public void execute( Hero hero, String action ) {
super.execute( hero, action );
if (action.equals( AC_OPEN )) {
GameScene.show( new WndBag( this, null, WndBag.Mode.ALL, null ) );
}
}
@Override
public boolean collect( Bag container ) {
for (Item item : container.items.toArray( new Item[0] )) {
if (grab( item )) {
int slot = Dungeon.quickslot.getSlot(item);
item.detachAll(container);
if (!item.collect(this)) {
item.collect(container);
}
if (slot != -1) {
Dungeon.quickslot.setSlot(slot, item);
}
}
}
if (super.collect( container )) {
owner = container.owner;
Badges.validateAllBagsBought( this );
return true;
} else {
return false;
}
}
@Override
public void onDetach( ) {
this.owner = null;
for (Item item : items)
Dungeon.quickslot.clearItem(item);
updateQuickslot();
}
@Override
public boolean isUpgradable() {
return false;
}
@Override
public boolean isIdentified() {
return true;
}
public void clear() {
items.clear();
}
public void resurrect() {
for (Item item : items.toArray(new Item[0])){
if (!item.unique) items.remove(item);
}
}
private static final String ITEMS = "inventory";
@Override
public void storeInBundle( Bundle bundle ) {
super.storeInBundle( bundle );
bundle.put( ITEMS, items );
}
@Override
public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle( bundle );
for (Bundlable item : bundle.getCollection( ITEMS )) {
if (item != null) ((Item)item).collect( this );
}
}
public boolean contains( Item item ) {
for (Item i : items) {
if (i == item) {
return true;
} else if (i instanceof Bag && ((Bag)i).contains( item )) {
return true;
}
}
return false;
}
public boolean grab( Item item ) {
return false;
}
@Override
public Iterator<Item> iterator() {
return new ItemIterator();
}
private class ItemIterator implements Iterator<Item> {
private int index = 0;
private Iterator<Item> nested = null;
@Override
public boolean hasNext() {
if (nested != null) {
return nested.hasNext() || index < items.size();
} else {
return index < items.size();
}
}
@Override
public Item next() {
if (nested != null && nested.hasNext()) {
return nested.next();
} else {
nested = null;
Item item = items.get( index++ );
if (item instanceof Bag) {
nested = ((Bag)item).iterator();
}
return item;
}
}
@Override
public void remove() {
if (nested != null) {
nested.remove();
} else {
items.remove( index );
}
}
}
}
| 4,354 | Bag | java | en | java | code | {"qsc_code_num_words": 514, "qsc_code_num_chars": 4354.0, "qsc_code_mean_word_length": 5.67120623, "qsc_code_frac_words_unique": 0.3307393, "qsc_code_frac_chars_top_2grams": 0.05283019, "qsc_code_frac_chars_top_3grams": 0.10428816, "qsc_code_frac_chars_top_4grams": 0.10566038, "qsc_code_frac_chars_dupe_5grams": 0.07753002, "qsc_code_frac_chars_dupe_6grams": 0.03430532, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00703812, "qsc_code_frac_chars_whitespace": 0.21681213, "qsc_code_size_file_byte": 4354.0, "qsc_code_num_lines": 200.0, "qsc_code_num_chars_line_max": 72.0, "qsc_code_num_chars_line_mean": 21.77, "qsc_code_frac_chars_alphabet": 0.84780059, "qsc_code_frac_chars_comments": 0.17937529, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.18115942, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0036384, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.10144928, "qsc_codejava_score_lines_no_logic": 0.26811594, "qsc_codejava_frac_words_no_modifier": 0.875, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 1 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/bags/PotionBandolier.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.bags;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class PotionBandolier extends Bag {
{
image = ItemSpriteSheet.BANDOLIER;
size = 20;
}
@Override
public boolean grab( Item item ) {
return item instanceof Potion;
}
@Override
public int price() {
return 40;
}
}
| 1,286 | PotionBandolier | java | en | java | code | {"qsc_code_num_words": 172, "qsc_code_num_chars": 1286.0, "qsc_code_mean_word_length": 5.64534884, "qsc_code_frac_words_unique": 0.61627907, "qsc_code_frac_chars_top_2grams": 0.0700309, "qsc_code_frac_chars_top_3grams": 0.15653965, "qsc_code_frac_chars_top_4grams": 0.05870237, "qsc_code_frac_chars_dupe_5grams": 0.1853759, "qsc_code_frac_chars_dupe_6grams": 0.0576725, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01975541, "qsc_code_frac_chars_whitespace": 0.17340591, "qsc_code_size_file_byte": 1286.0, "qsc_code_num_lines": 45.0, "qsc_code_num_chars_line_max": 73.0, "qsc_code_num_chars_line_mean": 28.57777778, "qsc_code_frac_chars_alphabet": 0.89369708, "qsc_code_frac_chars_comments": 0.60730949, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.11111111, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.11111111, "qsc_codejava_score_lines_no_logic": 0.38888889, "qsc_codejava_frac_words_no_modifier": 0.66666667, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/bags/ScrollHolder.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.bags;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
import com.shatteredpixel.shatteredpixeldungeon.items.spells.BeaconOfReturning;
import com.shatteredpixel.shatteredpixeldungeon.items.spells.Spell;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class ScrollHolder extends Bag {
{
image = ItemSpriteSheet.HOLDER;
size = 20;
}
@Override
public boolean grab( Item item ) {
return item instanceof Scroll || item instanceof Spell;
}
@Override
public void onDetach( ) {
super.onDetach();
for (Item item : items) {
if (item instanceof BeaconOfReturning) {
((BeaconOfReturning) item).returnDepth = -1;
}
}
}
@Override
public int price() {
return 40;
}
}
| 1,650 | ScrollHolder | java | en | java | code | {"qsc_code_num_words": 207, "qsc_code_num_chars": 1650.0, "qsc_code_mean_word_length": 5.97584541, "qsc_code_frac_words_unique": 0.55072464, "qsc_code_frac_chars_top_2grams": 0.08245756, "qsc_code_frac_chars_top_3grams": 0.1843169, "qsc_code_frac_chars_top_4grams": 0.1738076, "qsc_code_frac_chars_dupe_5grams": 0.23443816, "qsc_code_frac_chars_dupe_6grams": 0.13419563, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01607012, "qsc_code_frac_chars_whitespace": 0.17030303, "qsc_code_size_file_byte": 1650.0, "qsc_code_num_lines": 57.0, "qsc_code_num_chars_line_max": 80.0, "qsc_code_num_chars_line_mean": 28.94736842, "qsc_code_frac_chars_alphabet": 0.88750913, "qsc_code_frac_chars_comments": 0.47333333, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.10344828, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.10344828, "qsc_codejava_score_lines_no_logic": 0.34482759, "qsc_codejava_frac_words_no_modifier": 0.75, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/bags/VelvetPouch.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.bags;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone;
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class VelvetPouch extends Bag {
{
image = ItemSpriteSheet.POUCH;
size = 20;
}
@Override
public boolean grab( Item item ) {
return item instanceof Plant.Seed || item instanceof Runestone;
}
@Override
public int price() {
return 30;
}
}
| 1,379 | VelvetPouch | java | en | java | code | {"qsc_code_num_words": 182, "qsc_code_num_chars": 1379.0, "qsc_code_mean_word_length": 5.74725275, "qsc_code_frac_words_unique": 0.5989011, "qsc_code_frac_chars_top_2grams": 0.08126195, "qsc_code_frac_chars_top_3grams": 0.18164436, "qsc_code_frac_chars_top_4grams": 0.16826004, "qsc_code_frac_chars_dupe_5grams": 0.17208413, "qsc_code_frac_chars_dupe_6grams": 0.05353728, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01832461, "qsc_code_frac_chars_whitespace": 0.16896302, "qsc_code_size_file_byte": 1379.0, "qsc_code_num_lines": 46.0, "qsc_code_num_chars_line_max": 73.0, "qsc_code_num_chars_line_mean": 29.97826087, "qsc_code_frac_chars_alphabet": 0.89441536, "qsc_code_frac_chars_comments": 0.56635243, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.10526316, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.10526316, "qsc_codejava_score_lines_no_logic": 0.42105263, "qsc_codejava_frac_words_no_modifier": 0.66666667, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/bombs/ShockBomb.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.bombs;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Lightning;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.SparkParticle;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap;
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
import java.util.ArrayList;
public class ShockBomb extends Bomb {
{
image = ItemSpriteSheet.SHOCK_BOMB;
}
@Override
public void explode(int cell) {
super.explode(cell);
ArrayList<Char> affected = new ArrayList<>();
PathFinder.buildDistanceMap( cell, BArray.not( Dungeon.level.solid, null ), 3 );
for (int i = 0; i < PathFinder.distance.length; i++) {
if (PathFinder.distance[i] < Integer.MAX_VALUE
&& Actor.findChar(i) != null) {
affected.add(Actor.findChar(i));
}
}
for (Char ch : affected.toArray(new Char[0])){
Ballistica LOS = new Ballistica(cell, ch.pos, Ballistica.PROJECTILE);
if (LOS.collisionPos != ch.pos){
affected.remove(ch);
}
}
ArrayList<Lightning.Arc> arcs = new ArrayList<>();
for (Char ch : affected){
int power = 16 - 4*Dungeon.level.distance(ch.pos, cell);
if (power > 0){
//32% to 8% regular bomb damage
int damage = Math.round(Random.NormalIntRange(5 + Dungeon.depth, 10 + 2*Dungeon.depth) * (power/50f));
ch.damage(damage, this);
if (ch.isAlive()) Buff.prolong(ch, Paralysis.class, power);
arcs.add(new Lightning.Arc(DungeonTilemap.tileCenterToWorld(cell), ch.sprite.center()));
}
}
CellEmitter.center(cell).burst(SparkParticle.FACTORY, 20);
Dungeon.hero.sprite.parent.addToFront(new Lightning(arcs, null));
Sample.INSTANCE.play( Assets.SND_LIGHTNING );
}
@Override
public int price() {
//prices of ingredients
return quantity * (20 + 30);
}
}
| 3,295 | ShockBomb | java | en | java | code | {"qsc_code_num_words": 410, "qsc_code_num_chars": 3295.0, "qsc_code_mean_word_length": 6.06097561, "qsc_code_frac_words_unique": 0.45365854, "qsc_code_frac_chars_top_2grams": 0.05794769, "qsc_code_frac_chars_top_3grams": 0.21408451, "qsc_code_frac_chars_top_4grams": 0.23018109, "qsc_code_frac_chars_dupe_5grams": 0.17907445, "qsc_code_frac_chars_dupe_6grams": 0.0668008, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01370344, "qsc_code_frac_chars_whitespace": 0.13626707, "qsc_code_size_file_byte": 3295.0, "qsc_code_num_lines": 91.0, "qsc_code_num_chars_line_max": 107.0, "qsc_code_num_chars_line_mean": 36.20879121, "qsc_code_frac_chars_alphabet": 0.85945186, "qsc_code_frac_chars_comments": 0.25311077, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.03448276, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.03448276, "qsc_codejava_score_lines_no_logic": 0.34482759, "qsc_codejava_frac_words_no_modifier": 0.66666667, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/bombs/FrostBomb.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.bombs;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Freezing;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Frost;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
import com.watabou.utils.PathFinder;
public class FrostBomb extends Bomb {
{
image = ItemSpriteSheet.FROST_BOMB;
}
@Override
public void explode(int cell) {
super.explode(cell);
PathFinder.buildDistanceMap( cell, BArray.not( Dungeon.level.solid, null ), 2 );
for (int i = 0; i < PathFinder.distance.length; i++) {
if (PathFinder.distance[i] < Integer.MAX_VALUE) {
GameScene.add(Blob.seed(i, 10, Freezing.class));
Char ch = Actor.findChar(i);
if (ch != null){
Buff.affect(ch, Frost.class, 2f);
}
}
}
}
@Override
public int price() {
//prices of ingredients
return quantity * (20 + 30);
}
}
| 2,144 | FrostBomb | java | en | java | code | {"qsc_code_num_words": 272, "qsc_code_num_chars": 2144.0, "qsc_code_mean_word_length": 5.98897059, "qsc_code_frac_words_unique": 0.51102941, "qsc_code_frac_chars_top_2grams": 0.11479435, "qsc_code_frac_chars_top_3grams": 0.25659914, "qsc_code_frac_chars_top_4grams": 0.27010436, "qsc_code_frac_chars_dupe_5grams": 0.24677716, "qsc_code_frac_chars_dupe_6grams": 0.1694291, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01419214, "qsc_code_frac_chars_whitespace": 0.14552239, "qsc_code_size_file_byte": 2144.0, "qsc_code_num_lines": 62.0, "qsc_code_num_chars_line_max": 83.0, "qsc_code_num_chars_line_mean": 34.58064516, "qsc_code_frac_chars_alphabet": 0.875, "qsc_code_frac_chars_comments": 0.37453358, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.05714286, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.05714286, "qsc_codejava_score_lines_no_logic": 0.4, "qsc_codejava_frac_words_no_modifier": 0.66666667, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.potions;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Ooze;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.Splash;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.ItemStatusHandler;
import com.shatteredpixel.shatteredpixeldungeon.items.Recipe;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.elixirs.ElixirOfHoneyedHealing;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.ExoticPotion;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.PotionOfCleansing;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.PotionOfCorrosiveGas;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.PotionOfShroudingFog;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.PotionOfSnapFreeze;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.PotionOfStormClouds;
import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.plants.Blindweed;
import com.shatteredpixel.shatteredpixeldungeon.plants.Dreamfoil;
import com.shatteredpixel.shatteredpixeldungeon.plants.Earthroot;
import com.shatteredpixel.shatteredpixeldungeon.plants.Fadeleaf;
import com.shatteredpixel.shatteredpixeldungeon.plants.Firebloom;
import com.shatteredpixel.shatteredpixeldungeon.plants.Icecap;
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant;
import com.shatteredpixel.shatteredpixeldungeon.plants.Rotberry;
import com.shatteredpixel.shatteredpixeldungeon.plants.Sorrowmoss;
import com.shatteredpixel.shatteredpixeldungeon.plants.Starflower;
import com.shatteredpixel.shatteredpixeldungeon.plants.Stormvine;
import com.shatteredpixel.shatteredpixeldungeon.plants.Sungrass;
import com.shatteredpixel.shatteredpixeldungeon.plants.Swiftthistle;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndItem;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Bundle;
import com.watabou.utils.Random;
import com.watabou.utils.Reflection;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
public class Potion extends Item {
public static final String AC_DRINK = "DRINK";
//used internally for potions that can be drunk or thrown
public static final String AC_CHOOSE = "CHOOSE";
private static final float TIME_TO_DRINK = 1f;
protected Integer initials;
private static final Class<?>[] potions = {
PotionOfHealing.class,
PotionOfExperience.class,
PotionOfToxicGas.class,
PotionOfLiquidFlame.class,
PotionOfStrength.class,
PotionOfParalyticGas.class,
PotionOfLevitation.class,
PotionOfMindVision.class,
PotionOfPurity.class,
PotionOfInvisibility.class,
PotionOfHaste.class,
PotionOfFrost.class
};
private static final HashMap<String, Integer> colors = new HashMap<String, Integer>() {
{
put("crimson",ItemSpriteSheet.POTION_CRIMSON);
put("amber",ItemSpriteSheet.POTION_AMBER);
put("golden",ItemSpriteSheet.POTION_GOLDEN);
put("jade",ItemSpriteSheet.POTION_JADE);
put("turquoise",ItemSpriteSheet.POTION_TURQUOISE);
put("azure",ItemSpriteSheet.POTION_AZURE);
put("indigo",ItemSpriteSheet.POTION_INDIGO);
put("magenta",ItemSpriteSheet.POTION_MAGENTA);
put("bistre",ItemSpriteSheet.POTION_BISTRE);
put("charcoal",ItemSpriteSheet.POTION_CHARCOAL);
put("silver",ItemSpriteSheet.POTION_SILVER);
put("ivory",ItemSpriteSheet.POTION_IVORY);
}
};
private static final HashSet<Class<?extends Potion>> mustThrowPots = new HashSet<>();
static{
mustThrowPots.add(PotionOfToxicGas.class);
mustThrowPots.add(PotionOfLiquidFlame.class);
mustThrowPots.add(PotionOfParalyticGas.class);
mustThrowPots.add(PotionOfFrost.class);
//exotic
mustThrowPots.add(PotionOfCorrosiveGas.class);
mustThrowPots.add(PotionOfSnapFreeze.class);
mustThrowPots.add(PotionOfShroudingFog.class);
mustThrowPots.add(PotionOfStormClouds.class);
//also all brews, hardcoded
}
private static final HashSet<Class<?extends Potion>> canThrowPots = new HashSet<>();
static{
canThrowPots.add(AlchemicalCatalyst.class);
canThrowPots.add(PotionOfPurity.class);
canThrowPots.add(PotionOfLevitation.class);
//exotic
canThrowPots.add(PotionOfCleansing.class);
//elixirs
canThrowPots.add(ElixirOfHoneyedHealing.class);
}
protected static ItemStatusHandler<Potion> handler;
protected String color;
{
stackable = true;
defaultAction = AC_DRINK;
}
@SuppressWarnings("unchecked")
public static void initColors() {
handler = new ItemStatusHandler<>( (Class<? extends Potion>[])potions, colors );
}
public static void save( Bundle bundle ) {
handler.save( bundle );
}
public static void saveSelectively( Bundle bundle, ArrayList<Item> items ) {
ArrayList<Class<?extends Item>> classes = new ArrayList<>();
for (Item i : items){
if (i instanceof ExoticPotion){
if (!classes.contains(ExoticPotion.exoToReg.get(i.getClass()))){
classes.add(ExoticPotion.exoToReg.get(i.getClass()));
}
} else if (i instanceof Potion){
if (!classes.contains(i.getClass())){
classes.add(i.getClass());
}
}
}
handler.saveClassesSelectively( bundle, classes );
}
@SuppressWarnings("unchecked")
public static void restore( Bundle bundle ) {
handler = new ItemStatusHandler<>( (Class<? extends Potion>[])potions, colors, bundle );
}
public Potion() {
super();
reset();
}
//anonymous potions are always IDed, do not affect ID status,
//and their sprite is replaced by a placeholder if they are not known,
//useful for items that appear in UIs, or which are only spawned for their effects
protected boolean anonymous = false;
public void anonymize(){
if (!isKnown()) image = ItemSpriteSheet.POTION_HOLDER;
anonymous = true;
}
@Override
public void reset(){
super.reset();
if (handler != null && handler.contains(this)) {
image = handler.image(this);
color = handler.label(this);
}
setAction();
}
@Override
public boolean collect( Bag container ) {
if (super.collect( container )){
setAction();
return true;
} else {
return false;
}
}
public void setAction(){
if (isKnown() && mustThrowPots.contains(this.getClass())) {
defaultAction = AC_THROW;
} else if (isKnown() &&canThrowPots.contains(this.getClass())){
defaultAction = AC_CHOOSE;
} else {
defaultAction = AC_DRINK;
}
}
@Override
public ArrayList<String> actions( Hero hero ) {
ArrayList<String> actions = super.actions( hero );
actions.add( AC_DRINK );
return actions;
}
@Override
public void execute( final Hero hero, String action ) {
super.execute( hero, action );
if (action.equals( AC_CHOOSE )){
GameScene.show(new WndItem(null, this, true) );
} else if (action.equals( AC_DRINK )) {
if (isKnown() && mustThrowPots.contains(getClass())) {
GameScene.show(
new WndOptions( Messages.get(Potion.class, "harmful"),
Messages.get(Potion.class, "sure_drink"),
Messages.get(Potion.class, "yes"), Messages.get(Potion.class, "no") ) {
@Override
protected void onSelect(int index) {
if (index == 0) {
drink( hero );
}
}
}
);
} else {
drink( hero );
}
}
}
@Override
public void doThrow( final Hero hero ) {
if (isKnown()
&& !mustThrowPots.contains(this.getClass())
&& !canThrowPots.contains(this.getClass())) {
GameScene.show(
new WndOptions( Messages.get(Potion.class, "beneficial"),
Messages.get(Potion.class, "sure_throw"),
Messages.get(Potion.class, "yes"), Messages.get(Potion.class, "no") ) {
@Override
protected void onSelect(int index) {
if (index == 0) {
Potion.super.doThrow( hero );
}
}
}
);
} else {
super.doThrow( hero );
}
}
protected void drink( Hero hero ) {
detach( hero.belongings.backpack );
hero.spend( TIME_TO_DRINK );
hero.busy();
apply( hero );
Sample.INSTANCE.play( Assets.SND_DRINK );
hero.sprite.operate( hero.pos );
}
@Override
protected void onThrow( int cell ) {
if (Dungeon.level.map[cell] == Terrain.WELL || Dungeon.level.pit[cell]) {
super.onThrow( cell );
} else {
Dungeon.level.pressCell( cell );
shatter( cell );
}
}
public void apply( Hero hero ) {
shatter( hero.pos );
}
public void shatter( int cell ) {
if (Dungeon.level.heroFOV[cell]) {
GLog.i( Messages.get(Potion.class, "shatter") );
Sample.INSTANCE.play( Assets.SND_SHATTER );
splash( cell );
}
}
@Override
public void cast( final Hero user, int dst ) {
super.cast(user, dst);
}
public boolean isKnown() {
return anonymous || (handler != null && handler.isKnown( this ));
}
public void setKnown() {
if (!anonymous) {
if (!isKnown()) {
handler.know(this);
updateQuickslot();
Potion p = Dungeon.hero.belongings.getItem(getClass());
if (p != null) p.setAction();
if (ExoticPotion.regToExo.get(getClass()) != null) {
p = Dungeon.hero.belongings.getItem(ExoticPotion.regToExo.get(getClass()));
if (p != null) p.setAction();
}
}
if (Dungeon.hero.isAlive()) {
Catalog.setSeen(getClass());
}
}
}
@Override
public Item identify() {
setKnown();
return super.identify();
}
@Override
public String name() {
return isKnown() ? super.name() : Messages.get(this, color);
}
@Override
public String info() {
return isKnown() ? desc() : Messages.get(this, "unknown_desc");
}
public Integer initials(){
return isKnown() ? initials : null;
}
@Override
public boolean isIdentified() {
return isKnown();
}
@Override
public boolean isUpgradable() {
return false;
}
public static HashSet<Class<? extends Potion>> getKnown() {
return handler.known();
}
public static HashSet<Class<? extends Potion>> getUnknown() {
return handler.unknown();
}
public static boolean allKnown() {
return handler.known().size() == potions.length;
}
protected int splashColor(){
return anonymous ? 0x00AAFF : ItemSprite.pick( image, 5, 9 );
}
protected void splash( int cell ) {
Fire fire = (Fire)Dungeon.level.blobs.get( Fire.class );
if (fire != null)
fire.clear( cell );
final int color = splashColor();
Char ch = Actor.findChar(cell);
if (ch != null) {
Buff.detach(ch, Burning.class);
Buff.detach(ch, Ooze.class);
Splash.at( ch.sprite.center(), color, 5 );
} else {
Splash.at( cell, color, 5 );
}
}
@Override
public int price() {
return 30 * quantity;
}
public static class PlaceHolder extends Potion {
{
image = ItemSpriteSheet.POTION_HOLDER;
}
@Override
public boolean isSimilar(Item item) {
return ExoticPotion.regToExo.containsKey(item.getClass())
|| ExoticPotion.regToExo.containsValue(item.getClass());
}
@Override
public String info() {
return "";
}
}
public static class SeedToPotion extends Recipe {
public static HashMap<Class<?extends Plant.Seed>, Class<?extends Potion>> types = new HashMap<>();
static {
types.put(Blindweed.Seed.class, PotionOfInvisibility.class);
types.put(Dreamfoil.Seed.class, PotionOfPurity.class);
types.put(Earthroot.Seed.class, PotionOfParalyticGas.class);
types.put(Fadeleaf.Seed.class, PotionOfMindVision.class);
types.put(Firebloom.Seed.class, PotionOfLiquidFlame.class);
types.put(Icecap.Seed.class, PotionOfFrost.class);
types.put(Rotberry.Seed.class, PotionOfStrength.class);
types.put(Sorrowmoss.Seed.class, PotionOfToxicGas.class);
types.put(Starflower.Seed.class, PotionOfExperience.class);
types.put(Stormvine.Seed.class, PotionOfLevitation.class);
types.put(Sungrass.Seed.class, PotionOfHealing.class);
types.put(Swiftthistle.Seed.class, PotionOfHaste.class);
}
@Override
public boolean testIngredients(ArrayList<Item> ingredients) {
if (ingredients.size() != 3) {
return false;
}
for (Item ingredient : ingredients){
if (!(ingredient instanceof Plant.Seed
&& ingredient.quantity() >= 1
&& types.containsKey(ingredient.getClass()))){
return false;
}
}
return true;
}
@Override
public int cost(ArrayList<Item> ingredients) {
return 0;
}
@Override
public Item brew(ArrayList<Item> ingredients) {
if (!testIngredients(ingredients)) return null;
for (Item ingredient : ingredients){
ingredient.quantity(ingredient.quantity() - 1);
}
ArrayList<Class<?extends Plant.Seed>> seeds = new ArrayList<>();
for (Item i : ingredients) {
if (!seeds.contains(i.getClass())) {
seeds.add((Class<? extends Plant.Seed>) i.getClass());
}
}
Item result;
if ( (seeds.size() == 2 && Random.Int(4) == 0)
|| (seeds.size() == 3 && Random.Int(2) == 0)) {
result = Generator.random( Generator.Category.POTION );
} else {
result = Reflection.newInstance(types.get(Random.element(ingredients).getClass()));
}
while (result instanceof PotionOfHealing
&& (Dungeon.isChallenged(Challenges.NO_HEALING)
|| Random.Int(10) < Dungeon.LimitedDrops.COOKING_HP.count)) {
result = Generator.random(Generator.Category.POTION);
}
if (result instanceof PotionOfHealing) {
Dungeon.LimitedDrops.COOKING_HP.count++;
}
Statistics.potionsCooked++;
Badges.validatePotionsCooked();
return result;
}
@Override
public Item sampleOutput(ArrayList<Item> ingredients) {
return new WndBag.Placeholder(ItemSpriteSheet.POTION_HOLDER){
{
name = Messages.get(SeedToPotion.class, "name");
}
@Override
public String info() {
return "";
}
};
}
}
}
| 16,036 | Potion | java | en | java | code | {"qsc_code_num_words": 1703, "qsc_code_num_chars": 16036.0, "qsc_code_mean_word_length": 6.7498532, "qsc_code_frac_words_unique": 0.21726365, "qsc_code_frac_chars_top_2grams": 0.04071335, "qsc_code_frac_chars_top_3grams": 0.16198347, "qsc_code_frac_chars_top_4grams": 0.18373206, "qsc_code_frac_chars_dupe_5grams": 0.30665507, "qsc_code_frac_chars_dupe_6grams": 0.1262288, "qsc_code_frac_chars_dupe_7grams": 0.08073075, "qsc_code_frac_chars_dupe_8grams": 0.03618965, "qsc_code_frac_chars_dupe_9grams": 0.0260983, "qsc_code_frac_chars_dupe_10grams": 0.01635494, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00305309, "qsc_code_frac_chars_whitespace": 0.16257171, "qsc_code_size_file_byte": 16036.0, "qsc_code_num_lines": 552.0, "qsc_code_num_chars_line_max": 101.0, "qsc_code_num_chars_line_mean": 29.05072464, "qsc_code_frac_chars_alphabet": 0.85293023, "qsc_code_frac_chars_comments": 0.06878274, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.16393443, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.01158508, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.00053573, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.09836066, "qsc_codejava_score_lines_no_logic": 0.264637, "qsc_codejava_frac_words_no_modifier": 0.8372093, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfHealing.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.potions;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Bleeding;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Cripple;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Healing;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Poison;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Weakness;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
public class PotionOfHealing extends Potion {
{
initials = 3;
bones = true;
}
@Override
public void apply( Hero hero ) {
setKnown();
//starts out healing 30 hp, equalizes with hero health total at level 11
Buff.affect( hero, Healing.class ).setHeal((int)(0.8f*hero.HT + 14), 0.25f, 0);
cure( hero );
GLog.p( Messages.get(this, "heal") );
}
public static void cure( Char ch ) {
Buff.detach( ch, Poison.class );
Buff.detach( ch, Cripple.class );
Buff.detach( ch, Weakness.class );
Buff.detach( ch, Bleeding.class );
}
@Override
public int price() {
return isKnown() ? 30 * quantity : super.price();
}
}
| 2,165 | PotionOfHealing | java | en | java | code | {"qsc_code_num_words": 282, "qsc_code_num_chars": 2165.0, "qsc_code_mean_word_length": 5.82624113, "qsc_code_frac_words_unique": 0.4893617, "qsc_code_frac_chars_top_2grams": 0.11381619, "qsc_code_frac_chars_top_3grams": 0.25441266, "qsc_code_frac_chars_top_4grams": 0.2678028, "qsc_code_frac_chars_dupe_5grams": 0.31162508, "qsc_code_frac_chars_dupe_6grams": 0.23493609, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01730665, "qsc_code_frac_chars_whitespace": 0.14595843, "qsc_code_size_file_byte": 2165.0, "qsc_code_num_lines": 63.0, "qsc_code_num_chars_line_max": 82.0, "qsc_code_num_chars_line_mean": 34.36507937, "qsc_code_frac_chars_alphabet": 0.87128177, "qsc_code_frac_chars_comments": 0.39399538, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.05882353, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00304878, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.11764706, "qsc_codejava_score_lines_no_logic": 0.44117647, "qsc_codejava_frac_words_no_modifier": 0.6, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfMindVision.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.potions;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MindVision;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
public class PotionOfMindVision extends Potion {
{
initials = 7;
}
@Override
public void apply( Hero hero ) {
setKnown();
Buff.affect( hero, MindVision.class, MindVision.DURATION );
Dungeon.observe();
if (Dungeon.level.mobs.size() > 0) {
GLog.i( Messages.get(this, "see_mobs") );
} else {
GLog.i( Messages.get(this, "see_none") );
}
}
@Override
public int price() {
return isKnown() ? 30 * quantity : super.price();
}
}
| 1,695 | PotionOfMindVision | java | en | java | code | {"qsc_code_num_words": 219, "qsc_code_num_chars": 1695.0, "qsc_code_mean_word_length": 5.78082192, "qsc_code_frac_words_unique": 0.55251142, "qsc_code_frac_chars_top_2grams": 0.09399684, "qsc_code_frac_chars_top_3grams": 0.21011058, "qsc_code_frac_chars_top_4grams": 0.20853081, "qsc_code_frac_chars_dupe_5grams": 0.22748815, "qsc_code_frac_chars_dupe_6grams": 0.16745656, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01471619, "qsc_code_frac_chars_whitespace": 0.15811209, "qsc_code_size_file_byte": 1695.0, "qsc_code_num_lines": 53.0, "qsc_code_num_chars_line_max": 73.0, "qsc_code_num_chars_line_mean": 31.98113208, "qsc_code_frac_chars_alphabet": 0.87245971, "qsc_code_frac_chars_comments": 0.46076696, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.07407407, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.01750547, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.11111111, "qsc_codejava_score_lines_no_logic": 0.37037037, "qsc_codejava_frac_words_no_modifier": 0.5, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfParalyticGas.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.potions;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ParalyticGas;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.watabou.noosa.audio.Sample;
public class PotionOfParalyticGas extends Potion {
{
initials = 8;
}
@Override
public void shatter( int cell ) {
if (Dungeon.level.heroFOV[cell]) {
setKnown();
splash( cell );
Sample.INSTANCE.play( Assets.SND_SHATTER );
}
GameScene.add( Blob.seed( cell, 1000, ParalyticGas.class ) );
}
@Override
public int price() {
return isKnown() ? 40 * quantity : super.price();
}
}
| 1,613 | PotionOfParalyticGas | java | en | java | code | {"qsc_code_num_words": 208, "qsc_code_num_chars": 1613.0, "qsc_code_mean_word_length": 5.83173077, "qsc_code_frac_words_unique": 0.59134615, "qsc_code_frac_chars_top_2grams": 0.08408904, "qsc_code_frac_chars_top_3grams": 0.18796373, "qsc_code_frac_chars_top_4grams": 0.18136851, "qsc_code_frac_chars_dupe_5grams": 0.15828524, "qsc_code_frac_chars_dupe_6grams": 0.13685078, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01772526, "qsc_code_frac_chars_whitespace": 0.16057037, "qsc_code_size_file_byte": 1613.0, "qsc_code_num_lines": 53.0, "qsc_code_num_chars_line_max": 75.0, "qsc_code_num_chars_line_mean": 30.43396226, "qsc_code_frac_chars_alphabet": 0.87813885, "qsc_code_frac_chars_comments": 0.48419095, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.08, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.12, "qsc_codejava_score_lines_no_logic": 0.4, "qsc_codejava_frac_words_no_modifier": 0.5, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfToxicGas.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.potions;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ToxicGas;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.watabou.noosa.audio.Sample;
public class PotionOfToxicGas extends Potion {
{
initials = 11;
}
@Override
public void shatter( int cell ) {
if (Dungeon.level.heroFOV[cell]) {
setKnown();
splash( cell );
Sample.INSTANCE.play( Assets.SND_SHATTER );
}
GameScene.add( Blob.seed( cell, 1000, ToxicGas.class ) );
}
@Override
public int price() {
return isKnown() ? 30 * quantity : super.price();
}
}
| 1,602 | PotionOfToxicGas | java | en | java | code | {"qsc_code_num_words": 208, "qsc_code_num_chars": 1602.0, "qsc_code_mean_word_length": 5.77884615, "qsc_code_frac_words_unique": 0.59134615, "qsc_code_frac_chars_top_2grams": 0.08485857, "qsc_code_frac_chars_top_3grams": 0.18968386, "qsc_code_frac_chars_top_4grams": 0.18302829, "qsc_code_frac_chars_dupe_5grams": 0.15973378, "qsc_code_frac_chars_dupe_6grams": 0.13810316, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01861504, "qsc_code_frac_chars_whitespace": 0.16167291, "qsc_code_size_file_byte": 1602.0, "qsc_code_num_lines": 53.0, "qsc_code_num_chars_line_max": 72.0, "qsc_code_num_chars_line_mean": 30.22641509, "qsc_code_frac_chars_alphabet": 0.87639613, "qsc_code_frac_chars_comments": 0.48751561, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.08, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.12, "qsc_codejava_score_lines_no_logic": 0.4, "qsc_codejava_frac_words_no_modifier": 0.5, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfLevitation.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.potions;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ConfusionGas;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Levitation;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
public class PotionOfLevitation extends Potion {
{
initials = 5;
}
@Override
public void shatter( int cell ) {
if (Dungeon.level.heroFOV[cell]) {
setKnown();
splash( cell );
Sample.INSTANCE.play( Assets.SND_SHATTER );
}
GameScene.add( Blob.seed( cell, 1000, ConfusionGas.class ) );
}
@Override
public void apply( Hero hero ) {
setKnown();
Buff.affect( hero, Levitation.class, Levitation.DURATION );
GLog.i( Messages.get(this, "float") );
}
@Override
public int price() {
return isKnown() ? 40 * quantity : super.price();
}
}
| 2,111 | PotionOfLevitation | java | en | java | code | {"qsc_code_num_words": 261, "qsc_code_num_chars": 2111.0, "qsc_code_mean_word_length": 6.1954023, "qsc_code_frac_words_unique": 0.5210728, "qsc_code_frac_chars_top_2grams": 0.11564626, "qsc_code_frac_chars_top_3grams": 0.2585034, "qsc_code_frac_chars_top_4grams": 0.27210884, "qsc_code_frac_chars_dupe_5grams": 0.21768707, "qsc_code_frac_chars_dupe_6grams": 0.17068646, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01324503, "qsc_code_frac_chars_whitespace": 0.14163903, "qsc_code_size_file_byte": 2111.0, "qsc_code_num_lines": 65.0, "qsc_code_num_chars_line_max": 75.0, "qsc_code_num_chars_line_mean": 32.47692308, "qsc_code_frac_chars_alphabet": 0.87913907, "qsc_code_frac_chars_comments": 0.36996684, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.13888889, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0037594, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.11111111, "qsc_codejava_score_lines_no_logic": 0.44444444, "qsc_codejava_frac_words_no_modifier": 0.6, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/LeatherArmor.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.armor;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class LeatherArmor extends Armor {
{
image = ItemSpriteSheet.ARMOR_LEATHER;
}
public LeatherArmor() {
super( 2 );
}
}
| 1,056 | LeatherArmor | java | en | java | code | {"qsc_code_num_words": 146, "qsc_code_num_chars": 1056.0, "qsc_code_mean_word_length": 5.39726027, "qsc_code_frac_words_unique": 0.64383562, "qsc_code_frac_chars_top_2grams": 0.04187817, "qsc_code_frac_chars_top_3grams": 0.04949239, "qsc_code_frac_chars_top_4grams": 0.07233503, "qsc_code_frac_chars_dupe_5grams": 0.10406091, "qsc_code_frac_chars_dupe_6grams": 0.07106599, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.02085747, "qsc_code_frac_chars_whitespace": 0.18276515, "qsc_code_size_file_byte": 1056.0, "qsc_code_num_lines": 35.0, "qsc_code_num_chars_line_max": 73.0, "qsc_code_num_chars_line_mean": 30.17142857, "qsc_code_frac_chars_alphabet": 0.89223638, "qsc_code_frac_chars_comments": 0.73958333, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.0, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.0, "qsc_codejava_score_lines_no_logic": 0.2, "qsc_codejava_frac_words_no_modifier": 0.0, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": null, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/ClothArmor.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.armor;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class ClothArmor extends Armor {
{
image = ItemSpriteSheet.ARMOR_CLOTH;
bones = false; //Finding them in bones would be semi-frequent and disappointing.
}
public ClothArmor() {
super( 1 );
}
}
| 1,134 | ClothArmor | java | en | java | code | {"qsc_code_num_words": 158, "qsc_code_num_chars": 1134.0, "qsc_code_mean_word_length": 5.34810127, "qsc_code_frac_words_unique": 0.64556962, "qsc_code_frac_chars_top_2grams": 0.03905325, "qsc_code_frac_chars_top_3grams": 0.04615385, "qsc_code_frac_chars_top_4grams": 0.06745562, "qsc_code_frac_chars_dupe_5grams": 0.09704142, "qsc_code_frac_chars_dupe_6grams": 0.06627219, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01943844, "qsc_code_frac_chars_whitespace": 0.18342152, "qsc_code_size_file_byte": 1134.0, "qsc_code_num_lines": 37.0, "qsc_code_num_chars_line_max": 83.0, "qsc_code_num_chars_line_mean": 30.64864865, "qsc_code_frac_chars_alphabet": 0.89308855, "qsc_code_frac_chars_comments": 0.74603175, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.0, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.0, "qsc_codejava_score_lines_no_logic": 0.18181818, "qsc_codejava_frac_words_no_modifier": 0.0, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": null, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/bombs/HolyBomb.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.bombs;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.effects.Flare;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.bombs.Bomb;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap;
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
import java.util.ArrayList;
public class HolyBomb extends Bomb {
{
image = ItemSpriteSheet.HOLY_BOMB;
}
@Override
public void explode(int cell) {
super.explode(cell);
if (Dungeon.level.heroFOV[cell]) {
new Flare(10, 64).show(Dungeon.hero.sprite.parent, DungeonTilemap.tileCenterToWorld(cell), 2f);
}
ArrayList<Char> affected = new ArrayList<>();
PathFinder.buildDistanceMap( cell, BArray.not( Dungeon.level.solid, null ), 2 );
for (int i = 0; i < PathFinder.distance.length; i++) {
if (PathFinder.distance[i] < Integer.MAX_VALUE) {
Char ch = Actor.findChar(i);
if (ch != null) {
affected.add(ch);
}
}
}
for (Char ch : affected){
if (ch.properties().contains(Char.Property.UNDEAD) || ch.properties().contains(Char.Property.DEMONIC)){
ch.sprite.emitter().start( ShadowParticle.UP, 0.05f, 10 );
//bomb deals an additional 67% damage to unholy enemies in a 5x5 range
int damage = Math.round(Random.NormalIntRange( Dungeon.depth+5, 10 + Dungeon.depth * 2 ) * 0.67f);
ch.damage(damage, this);
}
}
Sample.INSTANCE.play( Assets.SND_READ );
}
@Override
public int price() {
//prices of ingredients
return quantity * (20 + 30);
}
}
| 2,844 | HolyBomb | java | en | java | code | {"qsc_code_num_words": 360, "qsc_code_num_chars": 2844.0, "qsc_code_mean_word_length": 5.85833333, "qsc_code_frac_words_unique": 0.50555556, "qsc_code_frac_chars_top_2grams": 0.05547653, "qsc_code_frac_chars_top_3grams": 0.1981982, "qsc_code_frac_chars_top_4grams": 0.20862968, "qsc_code_frac_chars_dupe_5grams": 0.21052632, "qsc_code_frac_chars_dupe_6grams": 0.02655287, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01826484, "qsc_code_frac_chars_whitespace": 0.15295359, "qsc_code_size_file_byte": 2844.0, "qsc_code_num_lines": 85.0, "qsc_code_num_chars_line_max": 107.0, "qsc_code_num_chars_line_mean": 33.45882353, "qsc_code_frac_chars_alphabet": 0.85720216, "qsc_code_frac_chars_comments": 0.30696203, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.04081633, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.06122449, "qsc_codejava_score_lines_no_logic": 0.36734694, "qsc_codejava_frac_words_no_modifier": 0.5, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/quest/CorpseDust.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.quest;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Wraith;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Bundle;
import com.watabou.utils.Random;
import java.util.ArrayList;
public class CorpseDust extends Item {
{
image = ItemSpriteSheet.DUST;
cursed = true;
cursedKnown = true;
unique = true;
}
@Override
public ArrayList<String> actions(Hero hero) {
return new ArrayList<>(); //yup, no dropping this one
}
@Override
public boolean isUpgradable() {
return false;
}
@Override
public boolean isIdentified() {
return true;
}
@Override
public boolean doPickUp(Hero hero) {
if (super.doPickUp(hero)){
GLog.n( Messages.get( this, "chill") );
Buff.affect(hero, DustGhostSpawner.class);
return true;
}
return false;
}
@Override
protected void onDetach() {
DustGhostSpawner spawner = Dungeon.hero.buff(DustGhostSpawner.class);
if (spawner != null){
spawner.dispel();
}
}
public static class DustGhostSpawner extends Buff {
int spawnPower = 0;
@Override
public boolean act() {
spawnPower++;
int wraiths = 1; //we include the wraith we're trying to spawn
for (Mob mob : Dungeon.level.mobs){
if (mob instanceof Wraith){
wraiths++;
}
}
int powerNeeded = Math.min(25, wraiths*wraiths);
if (powerNeeded <= spawnPower){
spawnPower -= powerNeeded;
int pos = 0;
int tries = 20;
do{
pos = Random.Int(Dungeon.level.length());
tries --;
} while (tries > 0 && (!Dungeon.level.heroFOV[pos] || !Dungeon.level.passable[pos] || Actor.findChar( pos ) != null));
if (tries > 0) {
Wraith.spawnAt(pos);
Sample.INSTANCE.play(Assets.SND_CURSED);
}
}
spend(TICK);
return true;
}
public void dispel(){
detach();
for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])){
if (mob instanceof Wraith){
mob.die(null);
}
}
}
private static String SPAWNPOWER = "spawnpower";
@Override
public void storeInBundle(Bundle bundle) {
super.storeInBundle(bundle);
bundle.put( SPAWNPOWER, spawnPower );
}
@Override
public void restoreFromBundle(Bundle bundle) {
super.restoreFromBundle(bundle);
spawnPower = bundle.getInt( SPAWNPOWER );
}
}
}
| 3,731 | CorpseDust | java | en | java | code | {"qsc_code_num_words": 443, "qsc_code_num_chars": 3731.0, "qsc_code_mean_word_length": 6.06094808, "qsc_code_frac_words_unique": 0.41986456, "qsc_code_frac_chars_top_2grams": 0.04692737, "qsc_code_frac_chars_top_3grams": 0.1698324, "qsc_code_frac_chars_top_4grams": 0.18026071, "qsc_code_frac_chars_dupe_5grams": 0.1735568, "qsc_code_frac_chars_dupe_6grams": 0.07970205, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00877763, "qsc_code_frac_chars_whitespace": 0.17555615, "qsc_code_size_file_byte": 3731.0, "qsc_code_num_lines": 142.0, "qsc_code_num_chars_line_max": 123.0, "qsc_code_num_chars_line_mean": 26.27464789, "qsc_code_frac_chars_alphabet": 0.86410923, "qsc_code_frac_chars_comments": 0.22862503, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.15, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00521195, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.08, "qsc_codejava_score_lines_no_logic": 0.29, "qsc_codejava_frac_words_no_modifier": 0.88888889, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/quest/MetalShard.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.quest;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class MetalShard extends Item {
{
image = ItemSpriteSheet.SHARD;
stackable = true;
}
@Override
public boolean isUpgradable() {
return false;
}
@Override
public boolean isIdentified() {
return true;
}
@Override
public int price() {
return quantity * 100;
}
}
| 1,273 | MetalShard | java | en | java | code | {"qsc_code_num_words": 168, "qsc_code_num_chars": 1273.0, "qsc_code_mean_word_length": 5.63095238, "qsc_code_frac_words_unique": 0.625, "qsc_code_frac_chars_top_2grams": 0.03488372, "qsc_code_frac_chars_top_3grams": 0.04122622, "qsc_code_frac_chars_top_4grams": 0.0602537, "qsc_code_frac_chars_dupe_5grams": 0.08668076, "qsc_code_frac_chars_dupe_6grams": 0.05919662, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01924928, "qsc_code_frac_chars_whitespace": 0.18381775, "qsc_code_size_file_byte": 1273.0, "qsc_code_num_lines": 48.0, "qsc_code_num_chars_line_max": 73.0, "qsc_code_num_chars_line_mean": 26.52083333, "qsc_code_frac_chars_alphabet": 0.89124158, "qsc_code_frac_chars_comments": 0.61272584, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.14285714, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.14285714, "qsc_codejava_score_lines_no_logic": 0.38095238, "qsc_codejava_frac_words_no_modifier": 0.75, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/quest/GooBlob.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.quest;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class GooBlob extends Item {
{
image = ItemSpriteSheet.BLOB;
stackable = true;
}
@Override
public boolean isUpgradable() {
return false;
}
@Override
public boolean isIdentified() {
return true;
}
@Override
public int price() {
return quantity * 50;
}
}
| 1,267 | GooBlob | java | en | java | code | {"qsc_code_num_words": 168, "qsc_code_num_chars": 1267.0, "qsc_code_mean_word_length": 5.60119048, "qsc_code_frac_words_unique": 0.625, "qsc_code_frac_chars_top_2grams": 0.03506908, "qsc_code_frac_chars_top_3grams": 0.04144527, "qsc_code_frac_chars_top_4grams": 0.06057386, "qsc_code_frac_chars_dupe_5grams": 0.08714134, "qsc_code_frac_chars_dupe_6grams": 0.05951116, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01837524, "qsc_code_frac_chars_whitespace": 0.18389897, "qsc_code_size_file_byte": 1267.0, "qsc_code_num_lines": 48.0, "qsc_code_num_chars_line_max": 73.0, "qsc_code_num_chars_line_mean": 26.39583333, "qsc_code_frac_chars_alphabet": 0.89168279, "qsc_code_frac_chars_comments": 0.61562747, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.14285714, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.14285714, "qsc_codejava_score_lines_no_logic": 0.38095238, "qsc_codejava_frac_words_no_modifier": 0.75, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/quest/RatSkull.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.quest;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
//this one's still hanging around to support quests from old saves
//I may reuse it at some point.
public class RatSkull extends Item {
{
image = ItemSpriteSheet.SKULL;
unique = true;
}
@Override
public boolean isUpgradable() {
return false;
}
@Override
public boolean isIdentified() {
return true;
}
}
| 1,307 | RatSkull | java | en | java | code | {"qsc_code_num_words": 180, "qsc_code_num_chars": 1307.0, "qsc_code_mean_word_length": 5.42777778, "qsc_code_frac_words_unique": 0.65, "qsc_code_frac_chars_top_2grams": 0.03377687, "qsc_code_frac_chars_top_3grams": 0.03991812, "qsc_code_frac_chars_top_4grams": 0.05834186, "qsc_code_frac_chars_dupe_5grams": 0.0839304, "qsc_code_frac_chars_dupe_6grams": 0.05731832, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01590271, "qsc_code_frac_chars_whitespace": 0.1820964, "qsc_code_size_file_byte": 1307.0, "qsc_code_num_lines": 45.0, "qsc_code_num_chars_line_max": 73.0, "qsc_code_num_chars_line_mean": 29.04444444, "qsc_code_frac_chars_alphabet": 0.89803555, "qsc_code_frac_chars_comments": 0.67176741, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.11764706, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.11764706, "qsc_codejava_score_lines_no_logic": 0.41176471, "qsc_codejava_frac_words_no_modifier": 0.66666667, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/quest/CeremonialCandle.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.quest;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.NewbornElemental;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ElmoParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
import java.util.ArrayList;
public class CeremonialCandle extends Item {
//generated with the wandmaker quest
public static int ritualPos;
{
image = ItemSpriteSheet.CANDLE;
defaultAction = AC_THROW;
unique = true;
stackable = true;
}
@Override
public boolean isUpgradable() {
return false;
}
@Override
public boolean isIdentified() {
return true;
}
@Override
public void doDrop(Hero hero) {
super.doDrop(hero);
checkCandles();
}
@Override
protected void onThrow(int cell) {
super.onThrow(cell);
checkCandles();
}
private static void checkCandles(){
Heap heapTop = Dungeon.level.heaps.get(ritualPos - Dungeon.level.width());
Heap heapRight = Dungeon.level.heaps.get(ritualPos + 1);
Heap heapBottom = Dungeon.level.heaps.get(ritualPos + Dungeon.level.width());
Heap heapLeft = Dungeon.level.heaps.get(ritualPos - 1);
if (heapTop != null &&
heapRight != null &&
heapBottom != null &&
heapLeft != null){
if (heapTop.peek() instanceof CeremonialCandle &&
heapRight.peek() instanceof CeremonialCandle &&
heapBottom.peek() instanceof CeremonialCandle &&
heapLeft.peek() instanceof CeremonialCandle){
heapTop.pickUp();
heapRight.pickUp();
heapBottom.pickUp();
heapLeft.pickUp();
NewbornElemental elemental = new NewbornElemental();
Char ch = Actor.findChar( ritualPos );
if (ch != null) {
ArrayList<Integer> candidates = new ArrayList<>();
for (int n : PathFinder.NEIGHBOURS8) {
int cell = ritualPos + n;
if ((Dungeon.level.passable[cell] || Dungeon.level.avoid[cell]) && Actor.findChar( cell ) == null) {
candidates.add( cell );
}
}
if (candidates.size() > 0) {
elemental.pos = Random.element( candidates );
} else {
elemental.pos = ritualPos;
}
} else {
elemental.pos = ritualPos;
}
elemental.state = elemental.HUNTING;
GameScene.add(elemental, 1);
for (int i : PathFinder.NEIGHBOURS9){
CellEmitter.get(ritualPos+i).burst(ElmoParticle.FACTORY, 10);
}
Sample.INSTANCE.play(Assets.SND_BURNING);
}
}
}
}
| 3,871 | CeremonialCandle | java | en | java | code | {"qsc_code_num_words": 436, "qsc_code_num_chars": 3871.0, "qsc_code_mean_word_length": 6.48623853, "qsc_code_frac_words_unique": 0.41743119, "qsc_code_frac_chars_top_2grams": 0.04773692, "qsc_code_frac_chars_top_3grams": 0.17468175, "qsc_code_frac_chars_top_4grams": 0.18670438, "qsc_code_frac_chars_dupe_5grams": 0.22701556, "qsc_code_frac_chars_dupe_6grams": 0.07637907, "qsc_code_frac_chars_dupe_7grams": 0.03536068, "qsc_code_frac_chars_dupe_8grams": 0.03536068, "qsc_code_frac_chars_dupe_9grams": 0.03536068, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00774473, "qsc_code_frac_chars_whitespace": 0.16610695, "qsc_code_size_file_byte": 3871.0, "qsc_code_num_lines": 128.0, "qsc_code_num_chars_line_max": 107.0, "qsc_code_num_chars_line_mean": 30.2421875, "qsc_code_frac_chars_alphabet": 0.86833953, "qsc_code_frac_chars_comments": 0.21105657, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.11363636, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.05681818, "qsc_codejava_score_lines_no_logic": 0.28409091, "qsc_codejava_frac_words_no_modifier": 0.83333333, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/quest/Pickaxe.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.quest;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Bat;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite.Glowing;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Bundle;
import com.watabou.utils.Callback;
import com.watabou.utils.PathFinder;
import java.util.ArrayList;
public class Pickaxe extends Weapon {
public static final String AC_MINE = "MINE";
public static final float TIME_TO_MINE = 2;
private static final Glowing BLOODY = new Glowing( 0x550000 );
{
image = ItemSpriteSheet.PICKAXE;
unique = true;
bones = false;
defaultAction = AC_MINE;
}
public boolean bloodStained = false;
@Override
public int min(int lvl) {
return 2; //tier 2
}
@Override
public int max(int lvl) {
return 15; //tier 2
}
@Override
public int STRReq(int lvl) {
return 14; //tier 3
}
@Override
public ArrayList<String> actions( Hero hero ) {
ArrayList<String> actions = super.actions( hero );
actions.add( AC_MINE );
return actions;
}
@Override
public void execute( final Hero hero, String action ) {
super.execute( hero, action );
if (action.equals(AC_MINE)) {
if (Dungeon.depth < 11 || Dungeon.depth > 15) {
GLog.w( Messages.get(this, "no_vein") );
return;
}
for (int i = 0; i < PathFinder.NEIGHBOURS8.length; i++) {
final int pos = hero.pos + PathFinder.NEIGHBOURS8[i];
if (Dungeon.level.map[pos] == Terrain.WALL_DECO) {
hero.spend( TIME_TO_MINE );
hero.busy();
hero.sprite.attack( pos, new Callback() {
@Override
public void call() {
CellEmitter.center( pos ).burst( Speck.factory( Speck.STAR ), 7 );
Sample.INSTANCE.play( Assets.SND_EVOKE );
Level.set( pos, Terrain.WALL );
GameScene.updateMap( pos );
DarkGold gold = new DarkGold();
if (gold.doPickUp( Dungeon.hero )) {
GLog.i( Messages.get(Dungeon.hero, "you_now_have", gold.name()) );
} else {
Dungeon.level.drop( gold, hero.pos ).sprite.drop();
}
hero.onOperateComplete();
}
} );
return;
}
}
GLog.w( Messages.get(this, "no_vein") );
}
}
@Override
public boolean isUpgradable() {
return false;
}
@Override
public boolean isIdentified() {
return true;
}
@Override
public int proc( Char attacker, Char defender, int damage ) {
if (!bloodStained && defender instanceof Bat && (defender.HP <= damage)) {
bloodStained = true;
updateQuickslot();
}
return damage;
}
private static final String BLOODSTAINED = "bloodStained";
@Override
public void storeInBundle( Bundle bundle ) {
super.storeInBundle( bundle );
bundle.put( BLOODSTAINED, bloodStained );
}
@Override
public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle( bundle );
bloodStained = bundle.getBoolean( BLOODSTAINED );
}
@Override
public Glowing glowing() {
return bloodStained ? BLOODY : null;
}
}
| 4,840 | Pickaxe | java | en | java | code | {"qsc_code_num_words": 560, "qsc_code_num_chars": 4840.0, "qsc_code_mean_word_length": 6.14285714, "qsc_code_frac_words_unique": 0.38214286, "qsc_code_frac_chars_top_2grams": 0.05494186, "qsc_code_frac_chars_top_3grams": 0.19883721, "qsc_code_frac_chars_top_4grams": 0.21744186, "qsc_code_frac_chars_dupe_5grams": 0.22267442, "qsc_code_frac_chars_dupe_6grams": 0.03139535, "qsc_code_frac_chars_dupe_7grams": 0.01511628, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01040873, "qsc_code_frac_chars_whitespace": 0.18615702, "qsc_code_size_file_byte": 4840.0, "qsc_code_num_lines": 180.0, "qsc_code_num_chars_line_max": 77.0, "qsc_code_num_chars_line_mean": 26.88888889, "qsc_code_frac_chars_alphabet": 0.86290937, "qsc_code_frac_chars_comments": 0.16632231, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.13445378, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.01040892, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.00198265, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.09243697, "qsc_codejava_score_lines_no_logic": 0.36134454, "qsc_codejava_frac_words_no_modifier": 0.91666667, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/quest/DwarfToken.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.quest;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class DwarfToken extends Item {
{
image = ItemSpriteSheet.TOKEN;
stackable = true;
unique = true;
}
@Override
public boolean isUpgradable() {
return false;
}
@Override
public boolean isIdentified() {
return true;
}
}
| 1,230 | DwarfToken | java | en | java | code | {"qsc_code_num_words": 163, "qsc_code_num_chars": 1230.0, "qsc_code_mean_word_length": 5.62576687, "qsc_code_frac_words_unique": 0.62576687, "qsc_code_frac_chars_top_2grams": 0.03598691, "qsc_code_frac_chars_top_3grams": 0.04252999, "qsc_code_frac_chars_top_4grams": 0.06215921, "qsc_code_frac_chars_dupe_5grams": 0.08942203, "qsc_code_frac_chars_dupe_6grams": 0.0610687, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01691542, "qsc_code_frac_chars_whitespace": 0.18292683, "qsc_code_size_file_byte": 1230.0, "qsc_code_num_lines": 44.0, "qsc_code_num_chars_line_max": 73.0, "qsc_code_num_chars_line_mean": 27.95454545, "qsc_code_frac_chars_alphabet": 0.89552239, "qsc_code_frac_chars_comments": 0.63495935, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.11111111, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.11111111, "qsc_codejava_score_lines_no_logic": 0.38888889, "qsc_codejava_frac_words_no_modifier": 0.66666667, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/quest/DarkGold.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.quest;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class DarkGold extends Item {
{
image = ItemSpriteSheet.ORE;
stackable = true;
unique = true;
}
@Override
public boolean isUpgradable() {
return false;
}
@Override
public boolean isIdentified() {
return true;
}
}
| 1,226 | DarkGold | java | en | java | code | {"qsc_code_num_words": 163, "qsc_code_num_chars": 1226.0, "qsc_code_mean_word_length": 5.60122699, "qsc_code_frac_words_unique": 0.62576687, "qsc_code_frac_chars_top_2grams": 0.03614458, "qsc_code_frac_chars_top_3grams": 0.04271632, "qsc_code_frac_chars_top_4grams": 0.06243154, "qsc_code_frac_chars_dupe_5grams": 0.0898138, "qsc_code_frac_chars_dupe_6grams": 0.06133625, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01698302, "qsc_code_frac_chars_whitespace": 0.18352365, "qsc_code_size_file_byte": 1226.0, "qsc_code_num_lines": 44.0, "qsc_code_num_chars_line_max": 73.0, "qsc_code_num_chars_line_mean": 27.86363636, "qsc_code_frac_chars_alphabet": 0.8951049, "qsc_code_frac_chars_comments": 0.637031, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.11111111, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.11111111, "qsc_codejava_score_lines_no_logic": 0.38888889, "qsc_codejava_frac_words_no_modifier": 0.66666667, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/quest/Embers.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.quest;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class Embers extends Item {
{
image = ItemSpriteSheet.EMBER;
unique = true;
}
@Override
public boolean isUpgradable() {
return false;
}
@Override
public boolean isIdentified() {
return true;
}
@Override
public ItemSprite.Glowing glowing() {
return new ItemSprite.Glowing(0x660000, 3f);
}
}
| 1,370 | Embers | java | en | java | code | {"qsc_code_num_words": 178, "qsc_code_num_chars": 1370.0, "qsc_code_mean_word_length": 5.81460674, "qsc_code_frac_words_unique": 0.59550562, "qsc_code_frac_chars_top_2grams": 0.06570048, "qsc_code_frac_chars_top_3grams": 0.1468599, "qsc_code_frac_chars_top_4grams": 0.05507246, "qsc_code_frac_chars_dupe_5grams": 0.17777778, "qsc_code_frac_chars_dupe_6grams": 0.05410628, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.02198769, "qsc_code_frac_chars_whitespace": 0.17007299, "qsc_code_size_file_byte": 1370.0, "qsc_code_num_lines": 49.0, "qsc_code_num_chars_line_max": 73.0, "qsc_code_num_chars_line_mean": 27.95918367, "qsc_code_frac_chars_alphabet": 0.88830255, "qsc_code_frac_chars_comments": 0.57007299, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.13636364, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.01358234, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.09090909, "qsc_codejava_score_lines_no_logic": 0.36363636, "qsc_codejava_frac_words_no_modifier": 0.66666667, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/spells/InventorySpell.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.spells;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
import com.watabou.noosa.audio.Sample;
public abstract class InventorySpell extends Spell {
protected String inventoryTitle = Messages.get(this, "inv_title");
protected WndBag.Mode mode = WndBag.Mode.ALL;
@Override
protected void onCast(Hero hero) {
curItem = detach( hero.belongings.backpack );
GameScene.selectItem( itemSelector, mode, inventoryTitle );
}
protected abstract void onItemSelected( Item item );
protected static WndBag.Listener itemSelector = new WndBag.Listener() {
@Override
public void onSelect( Item item ) {
//FIXME this safety check shouldn't be necessary
//it would be better to eliminate the curItem static variable.
if (!(curItem instanceof InventorySpell)){
return;
}
if (item != null) {
((InventorySpell)curItem).onItemSelected( item );
curUser.spend( 1f );
curUser.busy();
(curUser.sprite).operate( curUser.pos );
Sample.INSTANCE.play( Assets.SND_READ );
Invisibility.dispel();
} else {
curItem.collect( curUser.belongings.backpack );
}
}
};
}
| 2,375 | InventorySpell | java | en | java | code | {"qsc_code_num_words": 287, "qsc_code_num_chars": 2375.0, "qsc_code_mean_word_length": 6.19860627, "qsc_code_frac_words_unique": 0.54006969, "qsc_code_frac_chars_top_2grams": 0.07644744, "qsc_code_frac_chars_top_3grams": 0.17088252, "qsc_code_frac_chars_top_4grams": 0.17313097, "qsc_code_frac_chars_dupe_5grams": 0.10230467, "qsc_code_frac_chars_dupe_6grams": 0.03147836, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00905888, "qsc_code_frac_chars_whitespace": 0.16336842, "qsc_code_size_file_byte": 2375.0, "qsc_code_num_lines": 71.0, "qsc_code_num_chars_line_max": 75.0, "qsc_code_num_chars_line_mean": 33.45070423, "qsc_code_frac_chars_alphabet": 0.88626069, "qsc_code_frac_chars_comments": 0.37473684, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.05405405, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00606061, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.01408451, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.05405405, "qsc_codejava_score_lines_no_logic": 0.32432432, "qsc_codejava_frac_words_no_modifier": 0.66666667, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 1, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/spells/ReclaimTrap.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.spells;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.quest.MetalShard;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicMapping;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.Trap;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Bundle;
import com.watabou.utils.Reflection;
public class ReclaimTrap extends TargetedSpell {
{
image = ItemSpriteSheet.RECLAIM_TRAP;
}
private Class<?extends Trap> storedTrap = null;
@Override
protected void affectTarget(Ballistica bolt, Hero hero) {
if (storedTrap == null) {
quantity++; //storing a trap doesn't consume the spell
Trap t = Dungeon.level.traps.get(bolt.collisionPos);
if (t != null && t.active && t.visible) {
t.disarm();
Sample.INSTANCE.play(Assets.SND_LIGHTNING);
ScrollOfRecharging.charge(hero);
storedTrap = t.getClass();
} else {
GLog.w(Messages.get(this, "no_trap"));
}
} else {
Trap t = Reflection.newInstance(storedTrap);
storedTrap = null;
t.pos = bolt.collisionPos;
t.activate();
}
}
@Override
public String desc() {
String desc = super.desc();
if (storedTrap != null){
desc += "\n\n" + Messages.get(this, "desc_trap", Messages.get(storedTrap, "name"));
}
return desc;
}
@Override
protected void onThrow(int cell) {
storedTrap = null;
super.onThrow(cell);
}
@Override
public void doDrop(Hero hero) {
storedTrap = null;
super.doDrop(hero);
}
private static final ItemSprite.Glowing[] COLORS = new ItemSprite.Glowing[]{
new ItemSprite.Glowing( 0xFF0000 ),
new ItemSprite.Glowing( 0xFF8000 ),
new ItemSprite.Glowing( 0xFFFF00 ),
new ItemSprite.Glowing( 0x00FF00 ),
new ItemSprite.Glowing( 0x00FFFF ),
new ItemSprite.Glowing( 0x8000FF ),
new ItemSprite.Glowing( 0xFFFFFF ),
new ItemSprite.Glowing( 0x808080 ),
new ItemSprite.Glowing( 0x000000 )
};
@Override
public ItemSprite.Glowing glowing() {
if (storedTrap != null){
return COLORS[Reflection.newInstance(storedTrap).color];
}
return null;
}
@Override
public int price() {
//prices of ingredients, divided by output quantity
return Math.round(quantity * ((40 + 100) / 3f));
}
private static final String STORED_TRAP = "stored_trap";
@Override
public void storeInBundle(Bundle bundle) {
super.storeInBundle(bundle);
bundle.put(STORED_TRAP, storedTrap);
}
@Override
public void restoreFromBundle(Bundle bundle) {
super.restoreFromBundle(bundle);
storedTrap = bundle.getClass(STORED_TRAP);
}
public static class Recipe extends com.shatteredpixel.shatteredpixeldungeon.items.Recipe.SimpleRecipe {
{
inputs = new Class[]{ScrollOfMagicMapping.class, MetalShard.class};
inQuantity = new int[]{1, 1};
cost = 6;
output = ReclaimTrap.class;
outQuantity = 3;
}
}
}
| 4,302 | ReclaimTrap | java | en | java | code | {"qsc_code_num_words": 496, "qsc_code_num_chars": 4302.0, "qsc_code_mean_word_length": 6.37903226, "qsc_code_frac_words_unique": 0.39314516, "qsc_code_frac_chars_top_2grams": 0.04266751, "qsc_code_frac_chars_top_3grams": 0.16814159, "qsc_code_frac_chars_top_4grams": 0.16687737, "qsc_code_frac_chars_dupe_5grams": 0.10903919, "qsc_code_frac_chars_dupe_6grams": 0.05309735, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01884178, "qsc_code_frac_chars_whitespace": 0.16108787, "qsc_code_size_file_byte": 4302.0, "qsc_code_num_lines": 149.0, "qsc_code_num_chars_line_max": 105.0, "qsc_code_num_chars_line_mean": 28.87248322, "qsc_code_frac_chars_alphabet": 0.85785536, "qsc_code_frac_chars_comments": 0.20292887, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.14705882, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.01020706, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.02099738, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.06862745, "qsc_codejava_score_lines_no_logic": 0.24509804, "qsc_codejava_frac_words_no_modifier": 0.875, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/spells/AquaBlast.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.spells;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.Splash;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.PotionOfStormClouds;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
public class AquaBlast extends TargetedSpell {
{
image = ItemSpriteSheet.AQUA_BLAST;
}
@Override
protected void affectTarget(Ballistica bolt, Hero hero) {
int cell = bolt.collisionPos;
Splash.at(cell, 0x00AAFF, 10);
for (int i : PathFinder.NEIGHBOURS9){
if (i == 0 || Random.Int(5) != 0){
int terr = Dungeon.level.map[cell + i];
if (terr == Terrain.EMPTY || terr == Terrain.GRASS ||
terr == Terrain.EMBERS || terr == Terrain.EMPTY_SP ||
terr == Terrain.HIGH_GRASS || terr == Terrain.FURROWED_GRASS ||
terr == Terrain.EMPTY_DECO) {
Level.set(cell + i, Terrain.WATER);
GameScene.updateMap(cell + i);
}
}
}
Char target = Actor.findChar(cell);
if (target != null && target != hero){
//just enough to skip their current turn
Buff.affect(target, Paralysis.class, 0f);
}
}
@Override
public int price() {
//prices of ingredients, divided by output quantity
return Math.round(quantity * ((60 + 40) / 12f));
}
public static class Recipe extends com.shatteredpixel.shatteredpixeldungeon.items.Recipe.SimpleRecipe {
{
inputs = new Class[]{PotionOfStormClouds.class, ArcaneCatalyst.class};
inQuantity = new int[]{1, 1};
cost = 4;
output = AquaBlast.class;
outQuantity = 12;
}
}
}
| 3,094 | AquaBlast | java | en | java | code | {"qsc_code_num_words": 371, "qsc_code_num_chars": 3094.0, "qsc_code_mean_word_length": 6.19946092, "qsc_code_frac_words_unique": 0.48247978, "qsc_code_frac_chars_top_2grams": 0.11086957, "qsc_code_frac_chars_top_3grams": 0.24782609, "qsc_code_frac_chars_top_4grams": 0.24869565, "qsc_code_frac_chars_dupe_5grams": 0.19217391, "qsc_code_frac_chars_dupe_6grams": 0.07217391, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01456497, "qsc_code_frac_chars_whitespace": 0.15675501, "qsc_code_size_file_byte": 3094.0, "qsc_code_num_lines": 92.0, "qsc_code_num_chars_line_max": 105.0, "qsc_code_num_chars_line_mean": 33.63043478, "qsc_code_frac_chars_alphabet": 0.86699885, "qsc_code_frac_chars_comments": 0.28151261, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.03636364, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.00359874, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.03636364, "qsc_codejava_score_lines_no_logic": 0.32727273, "qsc_codejava_frac_words_no_modifier": 0.66666667, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/spells/FeatherFall.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.spells;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FlavourBuff;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLevitation;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
public class FeatherFall extends Spell {
{
image = ItemSpriteSheet.FEATHER_FALL;
}
@Override
protected void onCast(Hero hero) {
Buff.append(hero, FeatherBuff.class, 30f);
hero.sprite.operate(hero.pos);
Sample.INSTANCE.play(Assets.SND_READ );
hero.sprite.emitter().burst( Speck.factory( Speck.JET ), 20);
GLog.p(Messages.get(this, "light"));
detach( curUser.belongings.backpack );
updateQuickslot();
hero.spendAndNext( 1f );
}
public static class FeatherBuff extends FlavourBuff {
//does nothing, just waits to be triggered by chasm falling
}
@Override
public int price() {
//prices of ingredients, divided by output quantity
return Math.round(quantity * ((30 + 40) / 2f));
}
public static class Recipe extends com.shatteredpixel.shatteredpixeldungeon.items.Recipe.SimpleRecipe {
{
inputs = new Class[]{PotionOfLevitation.class, ArcaneCatalyst.class};
inQuantity = new int[]{1, 1};
cost = 6;
output = FeatherFall.class;
outQuantity = 2;
}
}
}
| 2,522 | FeatherFall | java | en | java | code | {"qsc_code_num_words": 309, "qsc_code_num_chars": 2522.0, "qsc_code_mean_word_length": 6.2038835, "qsc_code_frac_words_unique": 0.55987055, "qsc_code_frac_chars_top_2grams": 0.09754825, "qsc_code_frac_chars_top_3grams": 0.21804903, "qsc_code_frac_chars_top_4grams": 0.20657277, "qsc_code_frac_chars_dupe_5grams": 0.12623891, "qsc_code_frac_chars_dupe_6grams": 0.08659364, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01442531, "qsc_code_frac_chars_whitespace": 0.14789849, "qsc_code_size_file_byte": 2522.0, "qsc_code_num_lines": 78.0, "qsc_code_num_chars_line_max": 105.0, "qsc_code_num_chars_line_mean": 32.33333333, "qsc_code_frac_chars_alphabet": 0.8776175, "qsc_code_frac_chars_comments": 0.35289453, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.04761905, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00306373, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.04761905, "qsc_codejava_score_lines_no_logic": 0.30952381, "qsc_codejava_frac_words_no_modifier": 0.66666667, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/spells/MagicalPorter.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.spells;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.MerchantsBeacon;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
import java.util.ArrayList;
public class MagicalPorter extends InventorySpell {
{
image = ItemSpriteSheet.MAGIC_PORTER;
mode = WndBag.Mode.NOT_EQUIPPED;
}
@Override
protected void onCast(Hero hero) {
if (Dungeon.depth >= 25){
GLog.w(Messages.get(this, "nowhere"));
} else {
super.onCast(hero);
}
}
@Override
protected void onItemSelected(Item item) {
Item result = item.detachAll(curUser.belongings.backpack);
int portDepth = 5 * (1 + Dungeon.depth/5);
ArrayList<Item> ported = Dungeon.portedItems.get(portDepth);
if (ported == null) {
Dungeon.portedItems.put(portDepth, ported = new ArrayList<>());
}
ported.add(result);
}
@Override
public int price() {
//prices of ingredients, divided by output quantity
return Math.round(quantity * ((5 + 40) / 8f));
}
public static class Recipe extends com.shatteredpixel.shatteredpixeldungeon.items.Recipe.SimpleRecipe {
{
inputs = new Class[]{MerchantsBeacon.class, ArcaneCatalyst.class};
inQuantity = new int[]{1, 1};
cost = 4;
output = MagicalPorter.class;
outQuantity = 8;
}
}
}
| 2,486 | MagicalPorter | java | en | java | code | {"qsc_code_num_words": 301, "qsc_code_num_chars": 2486.0, "qsc_code_mean_word_length": 6.15282392, "qsc_code_frac_words_unique": 0.51827243, "qsc_code_frac_chars_top_2grams": 0.09179266, "qsc_code_frac_chars_top_3grams": 0.20518359, "qsc_code_frac_chars_top_4grams": 0.19006479, "qsc_code_frac_chars_dupe_5grams": 0.09719222, "qsc_code_frac_chars_dupe_6grams": 0.03023758, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.0143472, "qsc_code_frac_chars_whitespace": 0.15888978, "qsc_code_size_file_byte": 2486.0, "qsc_code_num_lines": 83.0, "qsc_code_num_chars_line_max": 105.0, "qsc_code_num_chars_line_mean": 29.95180723, "qsc_code_frac_chars_alphabet": 0.87135342, "qsc_code_frac_chars_comments": 0.33427192, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.06382979, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00422961, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.06382979, "qsc_codejava_score_lines_no_logic": 0.27659574, "qsc_codejava_frac_words_no_modifier": 0.75, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/spells/Recycle.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.spells;
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTransmutation;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ExoticScroll;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ScrollOfDivination;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.brews.Brew;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.elixirs.Elixir;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.ExoticPotion;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
import com.watabou.utils.Reflection;
public class Recycle extends InventorySpell {
{
image = ItemSpriteSheet.RECYCLE;
mode = WndBag.Mode.RECYCLABLE;
}
@Override
protected void onItemSelected(Item item) {
Item result;
do {
if (item instanceof Potion) {
result = Generator.random(Generator.Category.POTION);
if (item instanceof ExoticPotion){
result = Reflection.newInstance(ExoticPotion.regToExo.get(result.getClass()));
}
} else if (item instanceof Scroll) {
result = Generator.random(Generator.Category.SCROLL);
if (item instanceof ExoticScroll){
result = Reflection.newInstance(ExoticScroll.regToExo.get(result.getClass()));
}
} else if (item instanceof Plant.Seed) {
result = Generator.random(Generator.Category.SEED);
} else {
result = Generator.random(Generator.Category.STONE);
}
} while (result.getClass() == item.getClass() || Challenges.isItemBlocked(result));
item.detach(curUser.belongings.backpack);
GLog.p(Messages.get(this, "recycled", result.name()));
if (!result.collect()){
Dungeon.level.drop(result, curUser.pos).sprite.drop();
}
//TODO visuals
}
public static boolean isRecyclable(Item item){
return (item instanceof Potion && !(item instanceof Elixir || item instanceof Brew)) ||
item instanceof Scroll ||
item instanceof Plant.Seed ||
item instanceof Runestone;
}
@Override
public int price() {
//prices of ingredients, divided by output quantity
return Math.round(quantity * ((50 + 40) / 8f));
}
public static class Recipe extends com.shatteredpixel.shatteredpixeldungeon.items.Recipe.SimpleRecipe {
{
inputs = new Class[]{ScrollOfTransmutation.class, ArcaneCatalyst.class};
inQuantity = new int[]{1, 1};
cost = 6;
output = Recycle.class;
outQuantity = 8;
}
}
}
| 3,960 | Recycle | java | en | java | code | {"qsc_code_num_words": 445, "qsc_code_num_chars": 3960.0, "qsc_code_mean_word_length": 6.84494382, "qsc_code_frac_words_unique": 0.40449438, "qsc_code_frac_chars_top_2grams": 0.1116218, "qsc_code_frac_chars_top_3grams": 0.24950755, "qsc_code_frac_chars_top_4grams": 0.26001313, "qsc_code_frac_chars_dupe_5grams": 0.30564675, "qsc_code_frac_chars_dupe_6grams": 0.19894944, "qsc_code_frac_chars_dupe_7grams": 0.07025607, "qsc_code_frac_chars_dupe_8grams": 0.02954695, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00758017, "qsc_code_frac_chars_whitespace": 0.13383838, "qsc_code_size_file_byte": 3960.0, "qsc_code_num_lines": 106.0, "qsc_code_num_chars_line_max": 105.0, "qsc_code_num_chars_line_mean": 37.35849057, "qsc_code_frac_chars_alphabet": 0.88046647, "qsc_code_frac_chars_comments": 0.21338384, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.02816901, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00256822, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.00943396, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.04225352, "qsc_codejava_score_lines_no_logic": 0.33802817, "qsc_codejava_frac_words_no_modifier": 0.75, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.armor;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Momentum;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.BrokenSeal;
import com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.curses.AntiEntropy;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.curses.Bulk;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.curses.Corrosion;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.curses.Displacement;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.curses.Metabolism;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.curses.Multiplicity;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.curses.Overgrowth;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.curses.Stench;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Affection;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.AntiMagic;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Brimstone;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Camouflage;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Entanglement;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Flow;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Obfuscation;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Potential;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Repulsion;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Stone;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Swiftness;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Thorns;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Viscosity;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.particles.Emitter;
import com.watabou.utils.Bundlable;
import com.watabou.utils.Bundle;
import com.watabou.utils.Random;
import com.watabou.utils.Reflection;
import java.util.ArrayList;
import java.util.Arrays;
public class Armor extends EquipableItem {
protected static final String AC_DETACH = "DETACH";
public enum Augment {
EVASION (1.5f , -1f),
DEFENSE (-1.5f, 1f),
NONE (0f , 0f);
private float evasionFactor;
private float defenceFactor;
Augment(float eva, float df){
evasionFactor = eva;
defenceFactor = df;
}
public int evasionFactor(int level){
return Math.round((2 + level) * evasionFactor);
}
public int defenseFactor(int level){
return Math.round((2 + level) * defenceFactor);
}
}
public Augment augment = Augment.NONE;
public Glyph glyph;
public boolean curseInfusionBonus = false;
private BrokenSeal seal;
public int tier;
private static final int USES_TO_ID = 10;
private int usesLeftToID = USES_TO_ID;
private float availableUsesToID = USES_TO_ID/2f;
public Armor( int tier ) {
this.tier = tier;
}
private static final String USES_LEFT_TO_ID = "uses_left_to_id";
private static final String AVAILABLE_USES = "available_uses";
private static final String GLYPH = "glyph";
private static final String CURSE_INFUSION_BONUS = "curse_infusion_bonus";
private static final String SEAL = "seal";
private static final String AUGMENT = "augment";
@Override
public void storeInBundle( Bundle bundle ) {
super.storeInBundle( bundle );
bundle.put( USES_LEFT_TO_ID, usesLeftToID );
bundle.put( AVAILABLE_USES, availableUsesToID );
bundle.put( GLYPH, glyph );
bundle.put( CURSE_INFUSION_BONUS, curseInfusionBonus );
bundle.put( SEAL, seal);
bundle.put( AUGMENT, augment);
}
@Override
public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle(bundle);
usesLeftToID = bundle.getInt( USES_LEFT_TO_ID );
availableUsesToID = bundle.getInt( AVAILABLE_USES );
inscribe((Glyph) bundle.get(GLYPH));
curseInfusionBonus = bundle.getBoolean( CURSE_INFUSION_BONUS );
seal = (BrokenSeal)bundle.get(SEAL);
//pre-0.7.2 saves
if (bundle.contains( "unfamiliarity" )){
usesLeftToID = bundle.getInt( "unfamiliarity" );
availableUsesToID = USES_TO_ID/2f;
}
augment = bundle.getEnum(AUGMENT, Augment.class);
}
@Override
public void reset() {
super.reset();
usesLeftToID = USES_TO_ID;
availableUsesToID = USES_TO_ID/2f;
//armor can be kept in bones between runs, the seal cannot.
seal = null;
}
@Override
public ArrayList<String> actions(Hero hero) {
ArrayList<String> actions = super.actions(hero);
if (seal != null) actions.add(AC_DETACH);
return actions;
}
@Override
public void execute(Hero hero, String action) {
super.execute(hero, action);
if (action.equals(AC_DETACH) && seal != null){
BrokenSeal.WarriorShield sealBuff = hero.buff(BrokenSeal.WarriorShield.class);
if (sealBuff != null) sealBuff.setArmor(null);
if (seal.level() > 0){
degrade();
}
GLog.i( Messages.get(Armor.class, "detach_seal") );
hero.sprite.operate(hero.pos);
if (!seal.collect()){
Dungeon.level.drop(seal, hero.pos);
}
seal = null;
}
}
@Override
public boolean doEquip( Hero hero ) {
detach(hero.belongings.backpack);
if (hero.belongings.armor == null || hero.belongings.armor.doUnequip( hero, true, false )) {
hero.belongings.armor = this;
cursedKnown = true;
if (cursed) {
equipCursed( hero );
GLog.n( Messages.get(Armor.class, "equip_cursed") );
}
((HeroSprite)hero.sprite).updateArmor();
activate(hero);
hero.spendAndNext( time2equip( hero ) );
return true;
} else {
collect( hero.belongings.backpack );
return false;
}
}
@Override
public void activate(Char ch) {
if (seal != null) Buff.affect(ch, BrokenSeal.WarriorShield.class).setArmor(this);
}
public void affixSeal(BrokenSeal seal){
this.seal = seal;
if (seal.level() > 0){
//doesn't trigger upgrading logic such as affecting curses/glyphs
level(level()+1);
Badges.validateItemLevelAquired(this);
}
if (isEquipped(Dungeon.hero)){
Buff.affect(Dungeon.hero, BrokenSeal.WarriorShield.class).setArmor(this);
}
}
public BrokenSeal checkSeal(){
return seal;
}
@Override
protected float time2equip( Hero hero ) {
return 2 / hero.speed();
}
@Override
public boolean doUnequip( Hero hero, boolean collect, boolean single ) {
if (super.doUnequip( hero, collect, single )) {
hero.belongings.armor = null;
((HeroSprite)hero.sprite).updateArmor();
BrokenSeal.WarriorShield sealBuff = hero.buff(BrokenSeal.WarriorShield.class);
if (sealBuff != null) sealBuff.setArmor(null);
return true;
} else {
return false;
}
}
@Override
public boolean isEquipped( Hero hero ) {
return hero.belongings.armor == this;
}
public final int DRMax(){
return DRMax(level());
}
public int DRMax(int lvl){
int max = tier * (2 + lvl) + augment.defenseFactor(lvl);
if (lvl > max){
return ((lvl - max)+1)/2;
} else {
return max;
}
}
public final int DRMin(){
return DRMin(level());
}
public int DRMin(int lvl){
int max = DRMax(lvl);
if (lvl >= max){
return (lvl - max);
} else {
return lvl;
}
}
public float evasionFactor( Char owner, float evasion ){
if (hasGlyph(Stone.class, owner) && !((Stone)glyph).testingEvasion()){
return 0;
}
if (owner instanceof Hero){
int aEnc = STRReq() - ((Hero) owner).STR();
if (aEnc > 0) evasion /= Math.pow(1.5, aEnc);
Momentum momentum = owner.buff(Momentum.class);
if (momentum != null){
evasion += momentum.evasionBonus(Math.max(0, -aEnc));
}
}
return evasion + augment.evasionFactor(level());
}
public float speedFactor( Char owner, float speed ){
if (owner instanceof Hero) {
int aEnc = STRReq() - ((Hero) owner).STR();
if (aEnc > 0) speed /= Math.pow(1.2, aEnc);
}
if (hasGlyph(Swiftness.class, owner)) {
boolean enemyNear = false;
for (Char ch : Actor.chars()){
if (Dungeon.level.adjacent(ch.pos, owner.pos) && owner.alignment != ch.alignment){
enemyNear = true;
break;
}
}
if (!enemyNear) speed *= (1.2f + 0.04f * level());
} else if (hasGlyph(Flow.class, owner) && Dungeon.level.water[owner.pos]){
speed *= 2f;
}
if (hasGlyph(Bulk.class, owner) &&
(Dungeon.level.map[owner.pos] == Terrain.DOOR
|| Dungeon.level.map[owner.pos] == Terrain.OPEN_DOOR )) {
speed /= 3f;
}
return speed;
}
public float stealthFactor( Char owner, float stealth ){
if (hasGlyph(Obfuscation.class, owner)){
stealth += 1 + level()/3f;
}
return stealth;
}
@Override
public int level() {
return super.level() + (curseInfusionBonus ? 1 : 0);
}
@Override
public Item upgrade() {
return upgrade( false );
}
public Item upgrade( boolean inscribe ) {
if (inscribe && (glyph == null || glyph.curse())){
inscribe( Glyph.random() );
} else if (!inscribe && level() >= 4 && Random.Float(10) < Math.pow(2, level()-4)){
inscribe(null);
}
cursed = false;
if (seal != null && seal.level() == 0)
seal.upgrade();
return super.upgrade();
}
public int proc( Char attacker, Char defender, int damage ) {
if (glyph != null && defender.buff(MagicImmune.class) == null) {
damage = glyph.proc( this, attacker, defender, damage );
}
if (!levelKnown && defender == Dungeon.hero && availableUsesToID >= 1) {
availableUsesToID--;
usesLeftToID--;
if (usesLeftToID <= 0) {
identify();
GLog.p( Messages.get(Armor.class, "identify") );
Badges.validateItemLevelAquired( this );
}
}
return damage;
}
@Override
public void onHeroGainExp(float levelPercent, Hero hero) {
if (!levelKnown && isEquipped(hero) && availableUsesToID <= USES_TO_ID/2f) {
//gains enough uses to ID over 0.5 levels
availableUsesToID = Math.min(USES_TO_ID/2f, availableUsesToID + levelPercent * USES_TO_ID);
}
}
@Override
public String name() {
return glyph != null && (cursedKnown || !glyph.curse()) ? glyph.name( super.name() ) : super.name();
}
@Override
public String info() {
String info = desc();
if (levelKnown) {
info += "\n\n" + Messages.get(Armor.class, "curr_absorb", DRMin(), DRMax(), STRReq());
if (STRReq() > Dungeon.hero.STR()) {
info += " " + Messages.get(Armor.class, "too_heavy");
}
} else {
info += "\n\n" + Messages.get(Armor.class, "avg_absorb", DRMin(0), DRMax(0), STRReq(0));
if (STRReq(0) > Dungeon.hero.STR()) {
info += " " + Messages.get(Armor.class, "probably_too_heavy");
}
}
switch (augment) {
case EVASION:
info += "\n\n" + Messages.get(Armor.class, "evasion");
break;
case DEFENSE:
info += "\n\n" + Messages.get(Armor.class, "defense");
break;
case NONE:
}
if (glyph != null && (cursedKnown || !glyph.curse())) {
info += "\n\n" + Messages.get(Armor.class, "inscribed", glyph.name());
info += " " + glyph.desc();
}
if (cursed && isEquipped( Dungeon.hero )) {
info += "\n\n" + Messages.get(Armor.class, "cursed_worn");
} else if (cursedKnown && cursed) {
info += "\n\n" + Messages.get(Armor.class, "cursed");
} else if (seal != null) {
info += "\n\n" + Messages.get(Armor.class, "seal_attached");
} else if (!isIdentified() && cursedKnown){
info += "\n\n" + Messages.get(Armor.class, "not_cursed");
}
return info;
}
@Override
public Emitter emitter() {
if (seal == null) return super.emitter();
Emitter emitter = new Emitter();
emitter.pos(ItemSpriteSheet.film.width(image)/2f + 2f, ItemSpriteSheet.film.height(image)/3f);
emitter.fillTarget = false;
emitter.pour(Speck.factory( Speck.RED_LIGHT ), 0.6f);
return emitter;
}
@Override
public Item random() {
//+0: 75% (3/4)
//+1: 20% (4/20)
//+2: 5% (1/20)
int n = 0;
if (Random.Int(4) == 0) {
n++;
if (Random.Int(5) == 0) {
n++;
}
}
level(n);
//30% chance to be cursed
//15% chance to be inscribed
float effectRoll = Random.Float();
if (effectRoll < 0.3f) {
inscribe(Glyph.randomCurse());
cursed = true;
} else if (effectRoll >= 0.85f){
inscribe();
}
return this;
}
public int STRReq(){
return STRReq(level());
}
public int STRReq(int lvl){
lvl = Math.max(0, lvl);
//strength req decreases at +1,+3,+6,+10,etc.
return (8 + Math.round(tier * 2)) - (int)(Math.sqrt(8 * lvl + 1) - 1)/2;
}
@Override
public int price() {
if (seal != null) return 0;
int price = 20 * tier;
if (hasGoodGlyph()) {
price *= 1.5;
}
if (cursedKnown && (cursed || hasCurseGlyph())) {
price /= 2;
}
if (levelKnown && level() > 0) {
price *= (level() + 1);
}
if (price < 1) {
price = 1;
}
return price;
}
public Armor inscribe( Glyph glyph ) {
if (glyph == null || !glyph.curse()) curseInfusionBonus = false;
this.glyph = glyph;
updateQuickslot();
return this;
}
public Armor inscribe() {
Class<? extends Glyph> oldGlyphClass = glyph != null ? glyph.getClass() : null;
Glyph gl = Glyph.random( oldGlyphClass );
return inscribe( gl );
}
public boolean hasGlyph(Class<?extends Glyph> type, Char owner) {
return glyph != null && glyph.getClass() == type && owner.buff(MagicImmune.class) == null;
}
//these are not used to process specific glyph effects, so magic immune doesn't affect them
public boolean hasGoodGlyph(){
return glyph != null && !glyph.curse();
}
public boolean hasCurseGlyph(){
return glyph != null && glyph.curse();
}
@Override
public ItemSprite.Glowing glowing() {
return glyph != null && (cursedKnown || !glyph.curse()) ? glyph.glowing() : null;
}
public static abstract class Glyph implements Bundlable {
private static final Class<?>[] common = new Class<?>[]{
Obfuscation.class, Swiftness.class, Viscosity.class, Potential.class };
private static final Class<?>[] uncommon = new Class<?>[]{
Brimstone.class, Stone.class, Entanglement.class,
Repulsion.class, Camouflage.class, Flow.class };
private static final Class<?>[] rare = new Class<?>[]{
Affection.class, AntiMagic.class, Thorns.class };
private static final float[] typeChances = new float[]{
50, //12.5% each
40, //6.67% each
10 //3.33% each
};
private static final Class<?>[] curses = new Class<?>[]{
AntiEntropy.class, Corrosion.class, Displacement.class, Metabolism.class,
Multiplicity.class, Stench.class, Overgrowth.class, Bulk.class
};
public abstract int proc( Armor armor, Char attacker, Char defender, int damage );
public String name() {
if (!curse())
return name( Messages.get(this, "glyph") );
else
return name( Messages.get(Item.class, "curse"));
}
public String name( String armorName ) {
return Messages.get(this, "name", armorName);
}
public String desc() {
return Messages.get(this, "desc");
}
public boolean curse() {
return false;
}
@Override
public void restoreFromBundle( Bundle bundle ) {
}
@Override
public void storeInBundle( Bundle bundle ) {
}
public abstract ItemSprite.Glowing glowing();
@SuppressWarnings("unchecked")
public static Glyph random( Class<? extends Glyph> ... toIgnore ) {
switch(Random.chances(typeChances)){
case 0: default:
return randomCommon( toIgnore );
case 1:
return randomUncommon( toIgnore );
case 2:
return randomRare( toIgnore );
}
}
@SuppressWarnings("unchecked")
public static Glyph randomCommon( Class<? extends Glyph> ... toIgnore ){
ArrayList<Class<?>> glyphs = new ArrayList<>(Arrays.asList(common));
glyphs.removeAll(Arrays.asList(toIgnore));
if (glyphs.isEmpty()) {
return random();
} else {
return (Glyph) Reflection.newInstance(Random.element(glyphs));
}
}
@SuppressWarnings("unchecked")
public static Glyph randomUncommon( Class<? extends Glyph> ... toIgnore ){
ArrayList<Class<?>> glyphs = new ArrayList<>(Arrays.asList(uncommon));
glyphs.removeAll(Arrays.asList(toIgnore));
if (glyphs.isEmpty()) {
return random();
} else {
return (Glyph) Reflection.newInstance(Random.element(glyphs));
}
}
@SuppressWarnings("unchecked")
public static Glyph randomRare( Class<? extends Glyph> ... toIgnore ){
ArrayList<Class<?>> glyphs = new ArrayList<>(Arrays.asList(rare));
glyphs.removeAll(Arrays.asList(toIgnore));
if (glyphs.isEmpty()) {
return random();
} else {
return (Glyph) Reflection.newInstance(Random.element(glyphs));
}
}
@SuppressWarnings("unchecked")
public static Glyph randomCurse( Class<? extends Glyph> ... toIgnore ){
ArrayList<Class<?>> glyphs = new ArrayList<>(Arrays.asList(curses));
glyphs.removeAll(Arrays.asList(toIgnore));
if (glyphs.isEmpty()) {
return random();
} else {
return (Glyph) Reflection.newInstance(Random.element(glyphs));
}
}
}
}
| 18,699 | Armor | java | en | java | code | {"qsc_code_num_words": 2176, "qsc_code_num_chars": 18699.0, "qsc_code_mean_word_length": 5.88832721, "qsc_code_frac_words_unique": 0.17830882, "qsc_code_frac_chars_top_2grams": 0.03090611, "qsc_code_frac_chars_top_3grams": 0.11862952, "qsc_code_frac_chars_top_4grams": 0.13392648, "qsc_code_frac_chars_dupe_5grams": 0.35261063, "qsc_code_frac_chars_dupe_6grams": 0.27909155, "qsc_code_frac_chars_dupe_7grams": 0.23078124, "qsc_code_frac_chars_dupe_8grams": 0.10317646, "qsc_code_frac_chars_dupe_9grams": 0.09193788, "qsc_code_frac_chars_dupe_10grams": 0.09193788, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00999546, "qsc_code_frac_chars_whitespace": 0.1760522, "qsc_code_size_file_byte": 18699.0, "qsc_code_num_lines": 666.0, "qsc_code_num_chars_line_max": 103.0, "qsc_code_num_chars_line_mean": 28.07657658, "qsc_code_frac_chars_alphabet": 0.82163951, "qsc_code_frac_chars_comments": 0.06604631, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.1741683, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.01952588, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.11741683, "qsc_codejava_score_lines_no_logic": 0.25440313, "qsc_codejava_frac_words_no_modifier": 0.75409836, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 1 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/RogueArmor.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.armor;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Blindness;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.CellSelector;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.PathFinder;
public class RogueArmor extends ClassArmor {
{
image = ItemSpriteSheet.ARMOR_ROGUE;
}
@Override
public void doSpecial() {
GameScene.selectCell( teleporter );
}
protected static CellSelector.Listener teleporter = new CellSelector.Listener() {
@Override
public void onSelect( Integer target ) {
if (target != null) {
PathFinder.buildDistanceMap(curUser.pos, Dungeon.level.passable, 8);
if ( PathFinder.distance[target] == Integer.MAX_VALUE ||
!Dungeon.level.heroFOV[target] ||
!(Dungeon.level.passable[target] || Dungeon.level.avoid[target]) ||
Actor.findChar( target ) != null) {
GLog.w( Messages.get(RogueArmor.class, "fov") );
return;
}
curUser.HP -= (curUser.HP / 3);
for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) {
if (Dungeon.level.heroFOV[mob.pos] && mob.alignment != Char.Alignment.ALLY) {
Buff.prolong( mob, Blindness.class, 2 );
if (mob.state == mob.HUNTING) mob.state = mob.WANDERING;
mob.sprite.emitter().burst( Speck.factory( Speck.LIGHT ), 4 );
}
}
ScrollOfTeleportation.appear( curUser, target );
CellEmitter.get( target ).burst( Speck.factory( Speck.WOOL ), 10 );
Sample.INSTANCE.play( Assets.SND_PUFF );
Dungeon.level.occupyCell(curUser );
Dungeon.observe();
GameScene.updateFog();
curUser.spendAndNext( Actor.TICK );
}
}
@Override
public String prompt() {
return Messages.get(RogueArmor.class, "prompt");
}
};
} | 3,432 | RogueArmor | java | en | java | code | {"qsc_code_num_words": 393, "qsc_code_num_chars": 3432.0, "qsc_code_mean_word_length": 6.50381679, "qsc_code_frac_words_unique": 0.45038168, "qsc_code_frac_chars_top_2grams": 0.05985915, "qsc_code_frac_chars_top_3grams": 0.23787167, "qsc_code_frac_chars_top_4grams": 0.25821596, "qsc_code_frac_chars_dupe_5grams": 0.21283255, "qsc_code_frac_chars_dupe_6grams": 0.06494523, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00823328, "qsc_code_frac_chars_whitespace": 0.15064103, "qsc_code_size_file_byte": 3432.0, "qsc_code_num_lines": 95.0, "qsc_code_num_chars_line_max": 85.0, "qsc_code_num_chars_line_mean": 36.12631579, "qsc_code_frac_chars_alphabet": 0.86861063, "qsc_code_frac_chars_comments": 0.2275641, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.04918033, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00339367, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.04918033, "qsc_codejava_score_lines_no_logic": 0.36065574, "qsc_codejava_frac_words_no_modifier": 0.75, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/PlateArmor.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.armor;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class PlateArmor extends Armor {
{
image = ItemSpriteSheet.ARMOR_PLATE;
}
public PlateArmor() {
super( 5 );
}
}
| 1,050 | PlateArmor | java | en | java | code | {"qsc_code_num_words": 146, "qsc_code_num_chars": 1050.0, "qsc_code_mean_word_length": 5.35616438, "qsc_code_frac_words_unique": 0.64383562, "qsc_code_frac_chars_top_2grams": 0.04219949, "qsc_code_frac_chars_top_3grams": 0.04987212, "qsc_code_frac_chars_top_4grams": 0.07289003, "qsc_code_frac_chars_dupe_5grams": 0.10485934, "qsc_code_frac_chars_dupe_6grams": 0.07161125, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.0210035, "qsc_code_frac_chars_whitespace": 0.18380952, "qsc_code_size_file_byte": 1050.0, "qsc_code_num_lines": 35.0, "qsc_code_num_chars_line_max": 73.0, "qsc_code_num_chars_line_mean": 30.0, "qsc_code_frac_chars_alphabet": 0.89148191, "qsc_code_frac_chars_comments": 0.74380952, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.0, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.0, "qsc_codejava_score_lines_no_logic": 0.2, "qsc_codejava_frac_words_no_modifier": 0.0, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": null, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/MailArmor.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.armor;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class MailArmor extends Armor {
{
image = ItemSpriteSheet.ARMOR_MAIL;
}
public MailArmor() {
super( 3 );
}
}
| 1,047 | MailArmor | java | en | java | code | {"qsc_code_num_words": 146, "qsc_code_num_chars": 1047.0, "qsc_code_mean_word_length": 5.33561644, "qsc_code_frac_words_unique": 0.6369863, "qsc_code_frac_chars_top_2grams": 0.042362, "qsc_code_frac_chars_top_3grams": 0.05006418, "qsc_code_frac_chars_top_4grams": 0.07317073, "qsc_code_frac_chars_dupe_5grams": 0.10526316, "qsc_code_frac_chars_dupe_6grams": 0.07188703, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.02107728, "qsc_code_frac_chars_whitespace": 0.1843362, "qsc_code_size_file_byte": 1047.0, "qsc_code_num_lines": 35.0, "qsc_code_num_chars_line_max": 73.0, "qsc_code_num_chars_line_mean": 29.91428571, "qsc_code_frac_chars_alphabet": 0.8911007, "qsc_code_frac_chars_comments": 0.74594078, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.0, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.0, "qsc_codejava_score_lines_no_logic": 0.2, "qsc_codejava_frac_words_no_modifier": 0.0, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": null, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/MageArmor.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.armor;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Roots;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ElmoParticle;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
public class MageArmor extends ClassArmor {
{
image = ItemSpriteSheet.ARMOR_MAGE;
}
@Override
public void doSpecial() {
for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) {
if (Dungeon.level.heroFOV[mob.pos]
&& mob.alignment != Char.Alignment.ALLY) {
Buff.affect( mob, Burning.class ).reignite( mob );
Buff.prolong( mob, Roots.class, 3 );
}
}
curUser.HP -= (curUser.HP / 3);
curUser.spend( Actor.TICK );
curUser.sprite.operate( curUser.pos );
curUser.busy();
curUser.sprite.centerEmitter().start( ElmoParticle.FACTORY, 0.15f, 4 );
Sample.INSTANCE.play( Assets.SND_READ );
}
} | 2,179 | MageArmor | java | en | java | code | {"qsc_code_num_words": 274, "qsc_code_num_chars": 2179.0, "qsc_code_mean_word_length": 6.07664234, "qsc_code_frac_words_unique": 0.51094891, "qsc_code_frac_chars_top_2grams": 0.11231231, "qsc_code_frac_chars_top_3grams": 0.25105105, "qsc_code_frac_chars_top_4grams": 0.26426426, "qsc_code_frac_chars_dupe_5grams": 0.23843844, "qsc_code_frac_chars_dupe_6grams": 0.13273273, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01278636, "qsc_code_frac_chars_whitespace": 0.13859569, "qsc_code_size_file_byte": 2179.0, "qsc_code_num_lines": 62.0, "qsc_code_num_chars_line_max": 80.0, "qsc_code_num_chars_line_mean": 35.14516129, "qsc_code_frac_chars_alphabet": 0.87426745, "qsc_code_frac_chars_comments": 0.35842129, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.0, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.03030303, "qsc_codejava_score_lines_no_logic": 0.39393939, "qsc_codejava_frac_words_no_modifier": 0.5, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/HuntressArmor.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.armor;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Shuriken;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.sprites.MissileSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.utils.Callback;
import java.util.HashMap;
public class HuntressArmor extends ClassArmor {
{
image = ItemSpriteSheet.ARMOR_HUNTRESS;
}
private HashMap<Callback, Mob> targets = new HashMap<>();
@Override
public void doSpecial() {
Item proto = new Shuriken();
for (Mob mob : Dungeon.level.mobs) {
if (Dungeon.level.distance(curUser.pos, mob.pos) <= 12
&& Dungeon.level.heroFOV[mob.pos]
&& mob.alignment != Char.Alignment.ALLY) {
Callback callback = new Callback() {
@Override
public void call() {
curUser.attack( targets.get( this ) );
targets.remove( this );
if (targets.isEmpty()) {
curUser.spendAndNext( curUser.attackDelay() );
}
}
};
((MissileSprite)curUser.sprite.parent.recycle( MissileSprite.class )).
reset( curUser.pos, mob.pos, proto, callback );
targets.put( callback, mob );
}
}
if (targets.size() == 0) {
GLog.w( Messages.get(this, "no_enemies") );
return;
}
curUser.HP -= (curUser.HP / 3);
curUser.sprite.zap( curUser.pos );
curUser.busy();
}
} | 2,565 | HuntressArmor | java | en | java | code | {"qsc_code_num_words": 306, "qsc_code_num_chars": 2565.0, "qsc_code_mean_word_length": 6.0620915, "qsc_code_frac_words_unique": 0.47712418, "qsc_code_frac_chars_top_2grams": 0.0916442, "qsc_code_frac_chars_top_3grams": 0.20485175, "qsc_code_frac_chars_top_4grams": 0.21347709, "qsc_code_frac_chars_dupe_5grams": 0.20592992, "qsc_code_frac_chars_dupe_6grams": 0.03018868, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00989166, "qsc_code_frac_chars_whitespace": 0.17231969, "qsc_code_size_file_byte": 2565.0, "qsc_code_num_lines": 84.0, "qsc_code_num_chars_line_max": 80.0, "qsc_code_num_chars_line_mean": 30.53571429, "qsc_code_frac_chars_alphabet": 0.86387188, "qsc_code_frac_chars_comments": 0.30448343, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.04166667, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00560224, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.04166667, "qsc_codejava_score_lines_no_logic": 0.3125, "qsc_codejava_frac_words_no_modifier": 0.66666667, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/ScaleArmor.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.armor;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class ScaleArmor extends Armor {
{
image = ItemSpriteSheet.ARMOR_SCALE;
}
public ScaleArmor() {
super( 4 );
}
}
| 1,050 | ScaleArmor | java | en | java | code | {"qsc_code_num_words": 146, "qsc_code_num_chars": 1050.0, "qsc_code_mean_word_length": 5.35616438, "qsc_code_frac_words_unique": 0.64383562, "qsc_code_frac_chars_top_2grams": 0.04219949, "qsc_code_frac_chars_top_3grams": 0.04987212, "qsc_code_frac_chars_top_4grams": 0.07289003, "qsc_code_frac_chars_dupe_5grams": 0.10485934, "qsc_code_frac_chars_dupe_6grams": 0.07161125, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.0210035, "qsc_code_frac_chars_whitespace": 0.18380952, "qsc_code_size_file_byte": 1050.0, "qsc_code_num_lines": 35.0, "qsc_code_num_chars_line_max": 73.0, "qsc_code_num_chars_line_mean": 30.0, "qsc_code_frac_chars_alphabet": 0.89148191, "qsc_code_frac_chars_comments": 0.74380952, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.0, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.0, "qsc_codejava_score_lines_no_logic": 0.2, "qsc_codejava_frac_words_no_modifier": 0.0, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": null, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/WarriorArmor.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.armor;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.CellSelector;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.Camera;
import com.watabou.utils.Callback;
import com.watabou.utils.PathFinder;
public class WarriorArmor extends ClassArmor {
private static int LEAP_TIME = 1;
private static int SHOCK_TIME = 3;
{
image = ItemSpriteSheet.ARMOR_WARRIOR;
}
@Override
public void doSpecial() {
GameScene.selectCell( leaper );
}
protected static CellSelector.Listener leaper = new CellSelector.Listener() {
@Override
public void onSelect( Integer target ) {
if (target != null && target != curUser.pos) {
Ballistica route = new Ballistica(curUser.pos, target, Ballistica.PROJECTILE);
int cell = route.collisionPos;
//can't occupy the same cell as another char, so move back one.
if (Actor.findChar( cell ) != null && cell != curUser.pos)
cell = route.path.get(route.dist-1);
curUser.HP -= (curUser.HP / 3);
final int dest = cell;
curUser.busy();
curUser.sprite.jump(curUser.pos, cell, new Callback() {
@Override
public void call() {
curUser.move(dest);
Dungeon.level.occupyCell(curUser);
Dungeon.observe();
GameScene.updateFog();
for (int i = 0; i < PathFinder.NEIGHBOURS8.length; i++) {
Char mob = Actor.findChar(curUser.pos + PathFinder.NEIGHBOURS8[i]);
if (mob != null && mob != curUser && mob.alignment != Char.Alignment.ALLY) {
Buff.prolong(mob, Paralysis.class, SHOCK_TIME);
}
}
CellEmitter.center(dest).burst(Speck.factory(Speck.DUST), 10);
Camera.main.shake(2, 0.5f);
curUser.spendAndNext(LEAP_TIME);
}
});
}
}
@Override
public String prompt() {
return Messages.get(WarriorArmor.class, "prompt");
}
};
} | 3,356 | WarriorArmor | java | en | java | code | {"qsc_code_num_words": 402, "qsc_code_num_chars": 3356.0, "qsc_code_mean_word_length": 6.10447761, "qsc_code_frac_words_unique": 0.45522388, "qsc_code_frac_chars_top_2grams": 0.05501222, "qsc_code_frac_chars_top_3grams": 0.20130399, "qsc_code_frac_chars_top_4grams": 0.21515892, "qsc_code_frac_chars_dupe_5grams": 0.20130399, "qsc_code_frac_chars_dupe_6grams": 0.06764466, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01036825, "qsc_code_frac_chars_whitespace": 0.16656734, "qsc_code_size_file_byte": 3356.0, "qsc_code_num_lines": 100.0, "qsc_code_num_chars_line_max": 84.0, "qsc_code_num_chars_line_mean": 33.56, "qsc_code_frac_chars_alphabet": 0.86700036, "qsc_code_frac_chars_comments": 0.25148987, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.06349206, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00238758, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.06349206, "qsc_codejava_score_lines_no_logic": 0.31746032, "qsc_codejava_frac_words_no_modifier": 0.8, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/bombs/Flashbang.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.bombs;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Blindness;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Cripple;
import com.shatteredpixel.shatteredpixeldungeon.items.bombs.Bomb;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class Flashbang extends Bomb {
{
image = ItemSpriteSheet.FLASHBANG;
}
@Override
public void explode(int cell) {
super.explode(cell);
Level l = Dungeon.level;
for (Char ch : Actor.chars()){
if (ch.fieldOfView != null && ch.fieldOfView[cell]){
int power = 16 - 4*l.distance(ch.pos, cell);
if (power > 0){
Buff.prolong(ch, Blindness.class, power);
Buff.prolong(ch, Cripple.class, power);
}
if (ch == Dungeon.hero){
GameScene.flash(0xFFFFFF);
}
}
}
}
@Override
public int price() {
//prices of ingredients
return quantity * (20 + 40);
}
}
| 2,116 | Flashbang | java | en | java | code | {"qsc_code_num_words": 265, "qsc_code_num_chars": 2116.0, "qsc_code_mean_word_length": 6.0, "qsc_code_frac_words_unique": 0.49433962, "qsc_code_frac_chars_top_2grams": 0.11761006, "qsc_code_frac_chars_top_3grams": 0.26289308, "qsc_code_frac_chars_top_4grams": 0.27672956, "qsc_code_frac_chars_dupe_5grams": 0.27861635, "qsc_code_frac_chars_dupe_6grams": 0.13899371, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01454139, "qsc_code_frac_chars_whitespace": 0.15500945, "qsc_code_size_file_byte": 2116.0, "qsc_code_num_lines": 66.0, "qsc_code_num_chars_line_max": 73.0, "qsc_code_num_chars_line_mean": 32.06060606, "qsc_code_frac_chars_alphabet": 0.87472036, "qsc_code_frac_chars_comments": 0.3794896, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.05405405, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.00609292, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.05405405, "qsc_codejava_score_lines_no_logic": 0.35135135, "qsc_codejava_frac_words_no_modifier": 0.66666667, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/bombs/ShrapnelBomb.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.bombs;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.BlastParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.bombs.Bomb;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.ShadowCaster;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.utils.Point;
import com.watabou.utils.Random;
import java.util.ArrayList;
public class ShrapnelBomb extends Bomb {
{
image = ItemSpriteSheet.SHRAPNEL_BOMB;
}
@Override
public boolean explodesDestructively() {
return false;
}
@Override
public void explode(int cell) {
super.explode(cell);
boolean[] FOV = new boolean[Dungeon.level.length()];
Point c = Dungeon.level.cellToPoint(cell);
ShadowCaster.castShadow(c.x, c.y, FOV, Dungeon.level.losBlocking, 8);
ArrayList<Char> affected = new ArrayList<>();
for (int i = 0; i < FOV.length; i++) {
if (FOV[i]) {
if (Dungeon.level.heroFOV[i] && !Dungeon.level.solid[i]) {
//TODO better vfx?
CellEmitter.center( i ).burst( BlastParticle.FACTORY, 5 );
}
Char ch = Actor.findChar(i);
if (ch != null){
affected.add(ch);
}
}
}
for (Char ch : affected){
//regular bomb damage, which falls off at a rate of 5% per tile of distance
int damage = Math.round(Random.NormalIntRange( Dungeon.depth+5, 10 + Dungeon.depth * 2 ));
damage = Math.round(damage * (1f - .05f*Dungeon.level.distance(cell, ch.pos)));
damage -= ch.drRoll();
ch.damage(damage, this);
if (ch == Dungeon.hero && !ch.isAlive()) {
Dungeon.fail(Bomb.class);
}
}
}
@Override
public int price() {
//prices of ingredients
return quantity * (20 + 100);
}
}
| 2,777 | ShrapnelBomb | java | en | java | code | {"qsc_code_num_words": 356, "qsc_code_num_chars": 2777.0, "qsc_code_mean_word_length": 5.64325843, "qsc_code_frac_words_unique": 0.48595506, "qsc_code_frac_chars_top_2grams": 0.04479841, "qsc_code_frac_chars_top_3grams": 0.17023395, "qsc_code_frac_chars_top_4grams": 0.17521155, "qsc_code_frac_chars_dupe_5grams": 0.18914883, "qsc_code_frac_chars_dupe_6grams": 0.02787456, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01425486, "qsc_code_frac_chars_whitespace": 0.16636658, "qsc_code_size_file_byte": 2777.0, "qsc_code_num_lines": 88.0, "qsc_code_num_chars_line_max": 94.0, "qsc_code_num_chars_line_mean": 31.55681818, "qsc_code_frac_chars_alphabet": 0.85356371, "qsc_code_frac_chars_comments": 0.32265034, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.05660377, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.01136364, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.05660377, "qsc_codejava_score_lines_no_logic": 0.30188679, "qsc_codejava_frac_words_no_modifier": 0.75, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 1, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/bombs/Noisemaker.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.bombs;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mimic;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Bundle;
public class Noisemaker extends Bomb {
{
image = ItemSpriteSheet.NOISEMAKER;
}
public void setTrigger(int cell){
Buff.affect(Dungeon.hero, Trigger.class).set(cell);
CellEmitter.center( cell ).start( Speck.factory( Speck.SCREAM ), 0.3f, 3 );
Sample.INSTANCE.play( Assets.SND_ALERT );
for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) {
mob.beckon( cell );
}
for (Heap heap : Dungeon.level.heaps.valueList()) {
if (heap.type == Heap.Type.MIMIC) {
Mimic m = Mimic.spawnAt( heap.pos, heap.items );
if (m != null) {
m.beckon( cell );
heap.destroy();
}
}
}
}
public static class Trigger extends Buff {
int cell;
int floor;
int left;
public void set(int cell){
floor = Dungeon.depth;
this.cell = cell;
left = 6;
}
@Override
public boolean act() {
if (Dungeon.depth != floor){
spend(TICK);
return true;
}
Noisemaker bomb = null;
Heap heap = Dungeon.level.heaps.get(cell);
if (heap != null){
for (Item i : heap.items){
if (i instanceof Noisemaker){
bomb = (Noisemaker) i;
break;
}
}
}
if (bomb == null) {
detach();
} else if (Actor.findChar(cell) != null) {
heap.items.remove(bomb);
if (heap.items.isEmpty()) {
heap.destroy();
}
detach();
bomb.explode(cell);
} else {
spend(TICK);
left--;
if (left <= 0){
CellEmitter.center( cell ).start( Speck.factory( Speck.SCREAM ), 0.3f, 3 );
Sample.INSTANCE.play( Assets.SND_ALERT );
for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) {
mob.beckon( cell );
}
left = 6;
}
}
return true;
}
private static final String CELL = "cell";
private static final String FLOOR = "floor";
private static final String LEFT = "left";
@Override
public void storeInBundle(Bundle bundle) {
super.storeInBundle(bundle);
bundle.put(CELL, cell);
bundle.put(FLOOR, floor);
bundle.put(LEFT, left);
}
@Override
public void restoreFromBundle(Bundle bundle) {
super.restoreFromBundle(bundle);
cell = bundle.getInt(CELL);
floor = bundle.getInt(FLOOR);
left = bundle.getInt(LEFT);
}
}
@Override
public int price() {
//prices of ingredients
return quantity * (20 + 40);
}
}
| 3,917 | Noisemaker | java | en | java | code | {"qsc_code_num_words": 484, "qsc_code_num_chars": 3917.0, "qsc_code_mean_word_length": 5.56818182, "qsc_code_frac_words_unique": 0.36570248, "qsc_code_frac_chars_top_2grams": 0.04341373, "qsc_code_frac_chars_top_3grams": 0.16920223, "qsc_code_frac_chars_top_4grams": 0.17959184, "qsc_code_frac_chars_dupe_5grams": 0.32133581, "qsc_code_frac_chars_dupe_6grams": 0.16252319, "qsc_code_frac_chars_dupe_7grams": 0.10166976, "qsc_code_frac_chars_dupe_8grams": 0.10166976, "qsc_code_frac_chars_dupe_9grams": 0.10166976, "qsc_code_frac_chars_dupe_10grams": 0.10166976, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01017488, "qsc_code_frac_chars_whitespace": 0.19708961, "qsc_code_size_file_byte": 3917.0, "qsc_code_num_lines": 158.0, "qsc_code_num_chars_line_max": 81.0, "qsc_code_num_chars_line_mean": 24.79113924, "qsc_code_frac_chars_alphabet": 0.84674086, "qsc_code_frac_chars_comments": 0.20500383, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.20754717, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00417469, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.05660377, "qsc_codejava_score_lines_no_logic": 0.23584906, "qsc_codejava_frac_words_no_modifier": 0.85714286, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/bombs/WoollyBomb.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.bombs;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Sheep;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.bombs.Bomb;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
public class WoollyBomb extends Bomb {
{
image = ItemSpriteSheet.WOOLY_BOMB;
}
@Override
public void explode(int cell) {
super.explode(cell);
PathFinder.buildDistanceMap( cell, BArray.not( Dungeon.level.solid, null ), 2 );
for (int i = 0; i < PathFinder.distance.length; i++) {
if (PathFinder.distance[i] < Integer.MAX_VALUE) {
if (Dungeon.level.insideMap(i)
&& Actor.findChar(i) == null
&& !(Dungeon.level.pit[i])) {
Sheep sheep = new Sheep();
sheep.lifespan = Random.NormalIntRange( 8, 16 );
sheep.pos = i;
Dungeon.level.occupyCell(sheep);
GameScene.add(sheep);
CellEmitter.get(i).burst(Speck.factory(Speck.WOOL), 4);
}
}
}
Sample.INSTANCE.play(Assets.SND_PUFF);
}
@Override
public int price() {
//prices of ingredients
return quantity * (20 + 30);
}
}
| 2,454 | WoollyBomb | java | en | java | code | {"qsc_code_num_words": 307, "qsc_code_num_chars": 2454.0, "qsc_code_mean_word_length": 5.97068404, "qsc_code_frac_words_unique": 0.51140065, "qsc_code_frac_chars_top_2grams": 0.06382979, "qsc_code_frac_chars_top_3grams": 0.22804146, "qsc_code_frac_chars_top_4grams": 0.24004364, "qsc_code_frac_chars_dupe_5grams": 0.20731042, "qsc_code_frac_chars_dupe_6grams": 0.03055101, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01297453, "qsc_code_frac_chars_whitespace": 0.15199674, "qsc_code_size_file_byte": 2454.0, "qsc_code_num_lines": 74.0, "qsc_code_num_chars_line_max": 83.0, "qsc_code_num_chars_line_mean": 33.16216216, "qsc_code_frac_chars_alphabet": 0.86785199, "qsc_code_frac_chars_comments": 0.32722086, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.04651163, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.04651163, "qsc_codejava_score_lines_no_logic": 0.37209302, "qsc_codejava_frac_words_no_modifier": 0.66666667, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/bombs/RegrowthBomb.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.bombs;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Regrowth;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Healing;
import com.shatteredpixel.shatteredpixeldungeon.effects.Splash;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.bombs.Bomb;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfRegrowth;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant;
import com.shatteredpixel.shatteredpixeldungeon.plants.Starflower;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
import java.util.ArrayList;
public class RegrowthBomb extends Bomb {
{
//TODO visuals
image = ItemSpriteSheet.REGROWTH_BOMB;
}
@Override
public boolean explodesDestructively() {
return false;
}
@Override
public void explode(int cell) {
super.explode(cell);
if (Dungeon.level.heroFOV[cell]) {
Splash.at(cell, 0x00FF00, 30);
}
ArrayList<Integer> plantCandidates = new ArrayList<>();
PathFinder.buildDistanceMap( cell, BArray.not( Dungeon.level.solid, null ), 2 );
for (int i = 0; i < PathFinder.distance.length; i++) {
if (PathFinder.distance[i] < Integer.MAX_VALUE) {
Char ch = Actor.findChar(i);
if (ch != null){
if (ch.alignment == Dungeon.hero.alignment) {
//same as a healing potion
Buff.affect( ch, Healing.class ).setHeal((int)(0.8f*ch.HT + 14), 0.25f, 0);
PotionOfHealing.cure(ch);
}
} else if ( Dungeon.level.map[i] == Terrain.EMPTY ||
Dungeon.level.map[i] == Terrain.EMBERS ||
Dungeon.level.map[i] == Terrain.EMPTY_DECO ||
Dungeon.level.map[i] == Terrain.GRASS ||
Dungeon.level.map[i] == Terrain.HIGH_GRASS ||
Dungeon.level.map[i] == Terrain.FURROWED_GRASS){
plantCandidates.add(i);
}
GameScene.add( Blob.seed( i, 10, Regrowth.class ) );
}
}
int plants = Random.chances(new float[]{0, 6, 3, 1});
for (int i = 0; i < plants; i++) {
Integer plantPos = Random.element(plantCandidates);
if (plantPos != null) {
Dungeon.level.plant((Plant.Seed) Generator.random(Generator.Category.SEED), plantPos);
plantCandidates.remove(plantPos);
}
}
Integer plantPos = Random.element(plantCandidates);
if (plantPos != null){
Plant.Seed plant;
switch (Random.chances(new float[]{0, 6, 3, 1})){
case 1: default:
plant = new WandOfRegrowth.Dewcatcher.Seed();
break;
case 2:
plant = new WandOfRegrowth.Seedpod.Seed();
break;
case 3:
plant = new Starflower.Seed();
break;
}
Dungeon.level.plant( plant, plantPos);
}
}
@Override
public int price() {
//prices of ingredients
return quantity * (20 + 30);
}
}
| 4,249 | RegrowthBomb | java | en | java | code | {"qsc_code_num_words": 510, "qsc_code_num_chars": 4249.0, "qsc_code_mean_word_length": 6.07647059, "qsc_code_frac_words_unique": 0.38235294, "qsc_code_frac_chars_top_2grams": 0.05808325, "qsc_code_frac_chars_top_3grams": 0.23297838, "qsc_code_frac_chars_top_4grams": 0.25556631, "qsc_code_frac_chars_dupe_5grams": 0.35204905, "qsc_code_frac_chars_dupe_6grams": 0.17812197, "qsc_code_frac_chars_dupe_7grams": 0.0529203, "qsc_code_frac_chars_dupe_8grams": 0.0529203, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01452108, "qsc_code_frac_chars_whitespace": 0.15721346, "qsc_code_size_file_byte": 4249.0, "qsc_code_num_lines": 125.0, "qsc_code_num_chars_line_max": 91.0, "qsc_code_num_chars_line_mean": 33.992, "qsc_code_frac_chars_alphabet": 0.85087964, "qsc_code_frac_chars_comments": 0.19839962, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.11494253, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0023488, "qsc_code_frac_lines_prompt_comments": 0.008, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.03448276, "qsc_codejava_score_lines_no_logic": 0.29885057, "qsc_codejava_frac_words_no_modifier": 0.75, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/bombs/Firebomb.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.bombs;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.FlameParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.bombs.Bomb;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.PathFinder;
public class Firebomb extends Bomb {
{
image = ItemSpriteSheet.FIRE_BOMB;
}
@Override
public void explode(int cell) {
super.explode(cell);
PathFinder.buildDistanceMap( cell, BArray.not( Dungeon.level.solid, null ), 2 );
for (int i = 0; i < PathFinder.distance.length; i++) {
if (PathFinder.distance[i] < Integer.MAX_VALUE) {
if (Dungeon.level.pit[i])
GameScene.add(Blob.seed(i, 2, Fire.class));
else
GameScene.add(Blob.seed(i, 10, Fire.class));
CellEmitter.get(i).burst(FlameParticle.FACTORY, 5);
}
}
Sample.INSTANCE.play(Assets.SND_BURNING);
}
@Override
public int price() {
//prices of ingredients
return quantity * (20 + 30);
}
}
| 2,280 | Firebomb | java | en | java | code | {"qsc_code_num_words": 290, "qsc_code_num_chars": 2280.0, "qsc_code_mean_word_length": 6.00689655, "qsc_code_frac_words_unique": 0.51034483, "qsc_code_frac_chars_top_2grams": 0.0619977, "qsc_code_frac_chars_top_3grams": 0.23995408, "qsc_code_frac_chars_top_4grams": 0.25258324, "qsc_code_frac_chars_dupe_5grams": 0.24799082, "qsc_code_frac_chars_dupe_6grams": 0.09529277, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01375446, "qsc_code_frac_chars_whitespace": 0.13903509, "qsc_code_size_file_byte": 2280.0, "qsc_code_num_lines": 65.0, "qsc_code_num_chars_line_max": 83.0, "qsc_code_num_chars_line_mean": 35.07692308, "qsc_code_frac_chars_alphabet": 0.87366276, "qsc_code_frac_chars_comments": 0.35219298, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.05405405, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.05405405, "qsc_codejava_score_lines_no_logic": 0.40540541, "qsc_codejava_frac_words_no_modifier": 0.66666667, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/bombs/ArcaneBomb.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.bombs;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.GooWarn;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ElmoParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.bombs.Bomb;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
import java.util.ArrayList;
public class ArcaneBomb extends Bomb {
{
image = ItemSpriteSheet.ARCANE_BOMB;
}
@Override
protected void onThrow(int cell) {
super.onThrow(cell);
if (fuse != null){
PathFinder.buildDistanceMap( cell, BArray.not( Dungeon.level.solid, null ), 2 );
for (int i = 0; i < PathFinder.distance.length; i++) {
if (PathFinder.distance[i] < Integer.MAX_VALUE)
GameScene.add(Blob.seed(i, 3, GooWarn.class));
}
}
}
@Override
public boolean explodesDestructively() {
return false;
}
@Override
public void explode(int cell) {
super.explode(cell);
ArrayList<Char> affected = new ArrayList<>();
PathFinder.buildDistanceMap( cell, BArray.not( Dungeon.level.solid, null ), 2 );
for (int i = 0; i < PathFinder.distance.length; i++) {
if (PathFinder.distance[i] < Integer.MAX_VALUE) {
if (Dungeon.level.heroFOV[i]) {
CellEmitter.get(i).burst(ElmoParticle.FACTORY, 10);
}
Char ch = Actor.findChar(i);
if (ch != null){
affected.add(ch);
}
}
}
for (Char ch : affected){
// 100%/83%/67% bomb damage based on distance, but pierces armor.
int damage = Math.round(Random.NormalIntRange( Dungeon.depth+5, 10 + Dungeon.depth * 2 ));
float multiplier = 1f - (.16667f*Dungeon.level.distance(cell, ch.pos));
ch.damage(Math.round(damage*multiplier), this);
if (ch == Dungeon.hero && !ch.isAlive()){
Dungeon.fail(Bomb.class);
}
}
}
@Override
public int price() {
//prices of ingredients
return quantity * (20 + 50);
}
}
| 3,200 | ArcaneBomb | java | en | java | code | {"qsc_code_num_words": 400, "qsc_code_num_chars": 3200.0, "qsc_code_mean_word_length": 5.86, "qsc_code_frac_words_unique": 0.44, "qsc_code_frac_chars_top_2grams": 0.04991468, "qsc_code_frac_chars_top_3grams": 0.19453925, "qsc_code_frac_chars_top_4grams": 0.20648464, "qsc_code_frac_chars_dupe_5grams": 0.32081911, "qsc_code_frac_chars_dupe_6grams": 0.18259386, "qsc_code_frac_chars_dupe_7grams": 0.11177474, "qsc_code_frac_chars_dupe_8grams": 0.11177474, "qsc_code_frac_chars_dupe_9grams": 0.11177474, "qsc_code_frac_chars_dupe_10grams": 0.11177474, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01665433, "qsc_code_frac_chars_whitespace": 0.155625, "qsc_code_size_file_byte": 3200.0, "qsc_code_num_lines": 98.0, "qsc_code_num_chars_line_max": 94.0, "qsc_code_num_chars_line_mean": 32.65306122, "qsc_code_frac_chars_alphabet": 0.85085122, "qsc_code_frac_chars_comments": 0.27125, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.125, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.0625, "qsc_codejava_score_lines_no_logic": 0.3125, "qsc_codejava_frac_words_no_modifier": 0.8, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/bombs/Bomb.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.bombs;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.SPDSettings;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.BlastParticle;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.SmokeParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.Recipe;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfFrost;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfInvisibility;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLiquidFlame;
import com.shatteredpixel.shatteredpixeldungeon.items.quest.GooBlob;
import com.shatteredpixel.shatteredpixeldungeon.items.quest.MetalShard;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMirrorImage;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRage;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRemoveCurse;
import com.shatteredpixel.shatteredpixeldungeon.messages.Languages;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Bundle;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
import com.watabou.utils.Reflection;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
public class Bomb extends Item {
{
image = ItemSpriteSheet.BOMB;
defaultAction = AC_LIGHTTHROW;
usesTargeting = true;
stackable = true;
}
public Fuse fuse;
//FIXME using a static variable for this is kinda gross, should be a better way
private static boolean lightingFuse = false;
private static final String AC_LIGHTTHROW = "LIGHTTHROW";
@Override
public boolean isSimilar(Item item) {
return super.isSimilar(item) && this.fuse == ((Bomb) item).fuse;
}
public boolean explodesDestructively(){
return true;
}
@Override
public ArrayList<String> actions(Hero hero) {
ArrayList<String> actions = super.actions( hero );
actions.add ( AC_LIGHTTHROW );
return actions;
}
@Override
public void execute(Hero hero, String action) {
if (action.equals(AC_LIGHTTHROW)) {
lightingFuse = true;
action = AC_THROW;
} else
lightingFuse = false;
super.execute(hero, action);
}
@Override
protected void onThrow( int cell ) {
if (!Dungeon.level.pit[ cell ] && lightingFuse) {
Actor.addDelayed(fuse = new Fuse().ignite(this), 2);
}
if (Actor.findChar( cell ) != null && !(Actor.findChar( cell ) instanceof Hero) ){
ArrayList<Integer> candidates = new ArrayList<>();
for (int i : PathFinder.NEIGHBOURS8)
if (Dungeon.level.passable[cell + i])
candidates.add(cell + i);
int newCell = candidates.isEmpty() ? cell : Random.element(candidates);
Dungeon.level.drop( this, newCell ).sprite.drop( cell );
} else
super.onThrow( cell );
}
@Override
public boolean doPickUp(Hero hero) {
if (fuse != null) {
GLog.w( Messages.get(this, "snuff_fuse") );
fuse = null;
}
return super.doPickUp(hero);
}
public void explode(int cell){
//We're blowing up, so no need for a fuse anymore.
this.fuse = null;
Sample.INSTANCE.play( Assets.SND_BLAST );
if (explodesDestructively()) {
ArrayList<Char> affected = new ArrayList<>();
if (Dungeon.level.heroFOV[cell]) {
CellEmitter.center(cell).burst(BlastParticle.FACTORY, 30);
}
boolean terrainAffected = false;
for (int n : PathFinder.NEIGHBOURS9) {
int c = cell + n;
if (c >= 0 && c < Dungeon.level.length()) {
if (Dungeon.level.heroFOV[c]) {
CellEmitter.get(c).burst(SmokeParticle.FACTORY, 4);
}
if (Dungeon.level.flamable[c]) {
Dungeon.level.destroy(c);
GameScene.updateMap(c);
terrainAffected = true;
}
//destroys items / triggers bombs caught in the blast.
Heap heap = Dungeon.level.heaps.get(c);
if (heap != null)
heap.explode();
Char ch = Actor.findChar(c);
if (ch != null) {
affected.add(ch);
}
}
}
for (Char ch : affected){
int dmg = Random.NormalIntRange(5 + Dungeon.depth, 10 + Dungeon.depth*2);
//those not at the center of the blast take less damage
if (ch.pos != cell){
dmg = Math.round(dmg*0.67f);
}
dmg -= ch.drRoll();
if (dmg > 0) {
ch.damage(dmg, this);
}
if (ch == Dungeon.hero && !ch.isAlive()) {
Dungeon.fail(Bomb.class);
}
}
if (terrainAffected) {
Dungeon.observe();
}
}
}
@Override
public boolean isUpgradable() {
return false;
}
@Override
public boolean isIdentified() {
return true;
}
@Override
public Item random() {
switch(Random.Int( 4 )){
case 0:
return new DoubleBomb();
default:
return this;
}
}
@Override
public ItemSprite.Glowing glowing() {
return fuse != null ? new ItemSprite.Glowing( 0xFF0000, 0.6f) : null;
}
@Override
public int price() {
return 20 * quantity;
}
@Override
public String desc() {
if (fuse == null)
return super.desc()+ "\n\n" + Messages.get(this, "desc_fuse");
else
return super.desc() + "\n\n" + Messages.get(this, "desc_burning");
}
private static final String FUSE = "fuse";
@Override
public void storeInBundle(Bundle bundle) {
super.storeInBundle(bundle);
bundle.put( FUSE, fuse );
}
@Override
public void restoreFromBundle(Bundle bundle) {
super.restoreFromBundle(bundle);
if (bundle.contains( FUSE ))
Actor.add( fuse = ((Fuse)bundle.get(FUSE)).ignite(this) );
}
public static class Fuse extends Actor{
{
actPriority = BLOB_PRIO+1; //after hero, before other actors
}
private Bomb bomb;
public Fuse ignite(Bomb bomb){
this.bomb = bomb;
return this;
}
@Override
protected boolean act() {
//something caused our bomb to explode early, or be defused. Do nothing.
if (bomb.fuse != this){
Actor.remove( this );
return true;
}
//look for our bomb, remove it from its heap, and blow it up.
for (Heap heap : Dungeon.level.heaps.valueList()) {
if (heap.items.contains(bomb)) {
//FIXME this is a bit hacky, might want to generalize the functionality
//of bombs that don't explode instantly when their fuse ends
if (bomb instanceof Noisemaker){
((Noisemaker) bomb).setTrigger(heap.pos);
} else {
heap.items.remove(bomb);
if (heap.items.isEmpty()) {
heap.destroy();
}
bomb.explode(heap.pos);
}
diactivate();
Actor.remove(this);
return true;
}
}
//can't find our bomb, something must have removed it, do nothing.
bomb.fuse = null;
Actor.remove( this );
return true;
}
}
public static class DoubleBomb extends Bomb{
{
image = ItemSpriteSheet.DBL_BOMB;
stackable = false;
}
@Override
public boolean doPickUp(Hero hero) {
Bomb bomb = new Bomb();
bomb.quantity(2);
if (bomb.doPickUp(hero)) {
//isaaaaac.... (don't bother doing this when not in english)
if (SPDSettings.language() == Languages.ENGLISH)
hero.sprite.showStatus(CharSprite.NEUTRAL, "1+1 free!");
return true;
}
return false;
}
}
public static class EnhanceBomb extends Recipe {
public static final LinkedHashMap<Class<?extends Item>, Class<?extends Bomb>> validIngredients = new LinkedHashMap<>();
static {
validIngredients.put(PotionOfFrost.class, FrostBomb.class);
validIngredients.put(ScrollOfMirrorImage.class, WoollyBomb.class);
validIngredients.put(PotionOfLiquidFlame.class, Firebomb.class);
validIngredients.put(ScrollOfRage.class, Noisemaker.class);
validIngredients.put(PotionOfInvisibility.class, Flashbang.class);
validIngredients.put(ScrollOfRecharging.class, ShockBomb.class);
validIngredients.put(PotionOfHealing.class, RegrowthBomb.class);
validIngredients.put(ScrollOfRemoveCurse.class, HolyBomb.class);
validIngredients.put(GooBlob.class, ArcaneBomb.class);
validIngredients.put(MetalShard.class, ShrapnelBomb.class);
}
private static final HashMap<Class<?extends Bomb>, Integer> bombCosts = new HashMap<>();
static {
bombCosts.put(FrostBomb.class, 2);
bombCosts.put(WoollyBomb.class, 2);
bombCosts.put(Firebomb.class, 4);
bombCosts.put(Noisemaker.class, 4);
bombCosts.put(Flashbang.class, 6);
bombCosts.put(ShockBomb.class, 6);
bombCosts.put(RegrowthBomb.class, 8);
bombCosts.put(HolyBomb.class, 8);
bombCosts.put(ArcaneBomb.class, 10);
bombCosts.put(ShrapnelBomb.class, 10);
}
@Override
public boolean testIngredients(ArrayList<Item> ingredients) {
boolean bomb = false;
boolean ingredient = false;
for (Item i : ingredients){
if (!i.isIdentified()) return false;
if (i.getClass().equals(Bomb.class)){
bomb = true;
} else if (validIngredients.containsKey(i.getClass())){
ingredient = true;
}
}
return bomb && ingredient;
}
@Override
public int cost(ArrayList<Item> ingredients) {
for (Item i : ingredients){
if (validIngredients.containsKey(i.getClass())){
return (bombCosts.get(validIngredients.get(i.getClass())));
}
}
return 0;
}
@Override
public Item brew(ArrayList<Item> ingredients) {
Item result = null;
for (Item i : ingredients){
i.quantity(i.quantity()-1);
if (validIngredients.containsKey(i.getClass())){
result = Reflection.newInstance(validIngredients.get(i.getClass()));
}
}
return result;
}
@Override
public Item sampleOutput(ArrayList<Item> ingredients) {
for (Item i : ingredients){
if (validIngredients.containsKey(i.getClass())){
return Reflection.newInstance(validIngredients.get(i.getClass()));
}
}
return null;
}
}
}
| 11,609 | Bomb | java | en | java | code | {"qsc_code_num_words": 1313, "qsc_code_num_chars": 11609.0, "qsc_code_mean_word_length": 6.18354912, "qsc_code_frac_words_unique": 0.2551409, "qsc_code_frac_chars_top_2grams": 0.03768937, "qsc_code_frac_chars_top_3grams": 0.14041138, "qsc_code_frac_chars_top_4grams": 0.15716221, "qsc_code_frac_chars_dupe_5grams": 0.25877571, "qsc_code_frac_chars_dupe_6grams": 0.14312107, "qsc_code_frac_chars_dupe_7grams": 0.04384776, "qsc_code_frac_chars_dupe_8grams": 0.0302993, "qsc_code_frac_chars_dupe_9grams": 0.0302993, "qsc_code_frac_chars_dupe_10grams": 0.02143121, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00561143, "qsc_code_frac_chars_whitespace": 0.1864071, "qsc_code_size_file_byte": 11609.0, "qsc_code_num_lines": 415.0, "qsc_code_num_chars_line_max": 122.0, "qsc_code_num_chars_line_mean": 27.97349398, "qsc_code_frac_chars_alphabet": 0.85399682, "qsc_code_frac_chars_comments": 0.11801189, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.14563107, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00605528, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.00078133, "qsc_code_frac_lines_prompt_comments": 0.00240964, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.06472492, "qsc_codejava_score_lines_no_logic": 0.2394822, "qsc_codejava_frac_words_no_modifier": 0.95238095, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 1 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/spells/BeaconOfReturning.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.spells;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ScrollOfPassage;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.plants.Swiftthistle;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.scenes.InterlevelScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions;
import com.watabou.noosa.Game;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Bundle;
import com.watabou.utils.PathFinder;
public class BeaconOfReturning extends Spell {
{
image = ItemSpriteSheet.RETURN_BEACON;
}
public int returnDepth = -1;
public int returnPos;
@Override
protected void onCast(final Hero hero) {
if (returnDepth == -1){
setBeacon(hero);
} else {
GameScene.show(new WndOptions(Messages.titleCase(name()),
Messages.get(BeaconOfReturning.class, "wnd_body"),
Messages.get(BeaconOfReturning.class, "wnd_set"),
Messages.get(BeaconOfReturning.class, "wnd_return")){
@Override
protected void onSelect(int index) {
if (index == 0){
setBeacon(hero);
} else if (index == 1){
returnBeacon(hero);
}
}
});
}
}
//we reset return depth when beacons are dropped to prevent
//having two stacks of beacons with different return locations
@Override
protected void onThrow(int cell) {
returnDepth = -1;
super.onThrow(cell);
}
@Override
public void doDrop(Hero hero) {
returnDepth = -1;
super.doDrop(hero);
}
private void setBeacon(Hero hero ){
returnDepth = Dungeon.depth;
returnPos = hero.pos;
hero.spend( 1f );
hero.busy();
GLog.i( Messages.get(this, "set") );
hero.sprite.operate( hero.pos );
Sample.INSTANCE.play( Assets.SND_BEACON );
updateQuickslot();
}
private void returnBeacon( Hero hero ){
if (Dungeon.bossLevel()) {
GLog.w( Messages.get(this, "preventing") );
return;
}
for (int i = 0; i < PathFinder.NEIGHBOURS8.length; i++) {
Char ch = Actor.findChar(hero.pos + PathFinder.NEIGHBOURS8[i]);
if (ch != null && ch.alignment == Char.Alignment.ENEMY) {
GLog.w( Messages.get(this, "creatures") );
return;
}
}
if (returnDepth == Dungeon.depth) {
ScrollOfTeleportation.appear( hero, returnPos );
for(Mob m : Dungeon.level.mobs){
if (m.pos == hero.pos){
//displace mob
for(int i : PathFinder.NEIGHBOURS8){
if (Actor.findChar(m.pos+i) == null && Dungeon.level.passable[m.pos + i]){
m.pos += i;
m.sprite.point(m.sprite.worldToCamera(m.pos));
break;
}
}
}
}
Dungeon.level.occupyCell(hero );
Dungeon.observe();
GameScene.updateFog();
} else {
Buff buff = Dungeon.hero.buff(TimekeepersHourglass.timeFreeze.class);
if (buff != null) buff.detach();
buff = Dungeon.hero.buff(Swiftthistle.TimeBubble.class);
if (buff != null) buff.detach();
InterlevelScene.mode = InterlevelScene.Mode.RETURN;
InterlevelScene.returnDepth = returnDepth;
InterlevelScene.returnPos = returnPos;
Game.switchScene( InterlevelScene.class );
}
detach(hero.belongings.backpack);
}
@Override
public String desc() {
String desc = super.desc();
if (returnDepth != -1){
desc += "\n\n" + Messages.get(this, "desc_set", returnDepth);
}
return desc;
}
private static final ItemSprite.Glowing WHITE = new ItemSprite.Glowing( 0xFFFFFF );
@Override
public ItemSprite.Glowing glowing() {
return returnDepth != -1 ? WHITE : null;
}
private static final String DEPTH = "depth";
private static final String POS = "pos";
@Override
public void storeInBundle( Bundle bundle ) {
super.storeInBundle( bundle );
bundle.put( DEPTH, returnDepth );
if (returnDepth != -1) {
bundle.put( POS, returnPos );
}
}
@Override
public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle(bundle);
returnDepth = bundle.getInt( DEPTH );
returnPos = bundle.getInt( POS );
}
@Override
public int price() {
//prices of ingredients, divided by output quantity
return Math.round(quantity * ((50 + 40) / 5f));
}
public static class Recipe extends com.shatteredpixel.shatteredpixeldungeon.items.Recipe.SimpleRecipe {
{
inputs = new Class[]{ScrollOfPassage.class, ArcaneCatalyst.class};
inQuantity = new int[]{1, 1};
cost = 10;
output = BeaconOfReturning.class;
outQuantity = 5;
}
}
}
| 6,123 | BeaconOfReturning | java | en | java | code | {"qsc_code_num_words": 698, "qsc_code_num_chars": 6123.0, "qsc_code_mean_word_length": 6.31375358, "qsc_code_frac_words_unique": 0.34383954, "qsc_code_frac_chars_top_2grams": 0.04492852, "qsc_code_frac_chars_top_3grams": 0.17245292, "qsc_code_frac_chars_top_4grams": 0.17971409, "qsc_code_frac_chars_dupe_5grams": 0.20263218, "qsc_code_frac_chars_dupe_6grams": 0.04946676, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00823691, "qsc_code_frac_chars_whitespace": 0.16723828, "qsc_code_size_file_byte": 6123.0, "qsc_code_num_lines": 208.0, "qsc_code_num_chars_line_max": 105.0, "qsc_code_num_chars_line_mean": 29.4375, "qsc_code_frac_chars_alphabet": 0.85605021, "qsc_code_frac_chars_comments": 0.1577658, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.13815789, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.01299205, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.00155129, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.06578947, "qsc_codejava_score_lines_no_logic": 0.24342105, "qsc_codejava_frac_words_no_modifier": 0.90909091, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/spells/ArcaneCatalyst.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.spells;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfIdentify;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfLullaby;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicMapping;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMirrorImage;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRage;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRemoveCurse;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRetribution;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTerror;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTransmutation;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ExoticScroll;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone;
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.utils.Random;
import com.watabou.utils.Reflection;
import java.util.ArrayList;
import java.util.HashMap;
public class ArcaneCatalyst extends Spell {
{
image = ItemSpriteSheet.SCROLL_CATALYST;
}
private static HashMap<Class<? extends Scroll>, Float> scrollChances = new HashMap<>();
static{
scrollChances.put( ScrollOfIdentify.class, 3f );
scrollChances.put( ScrollOfRemoveCurse.class, 2f );
scrollChances.put( ScrollOfMagicMapping.class, 2f );
scrollChances.put( ScrollOfMirrorImage.class, 2f );
scrollChances.put( ScrollOfRecharging.class, 2f );
scrollChances.put( ScrollOfLullaby.class, 2f );
scrollChances.put( ScrollOfRetribution.class, 2f );
scrollChances.put( ScrollOfRage.class, 2f );
scrollChances.put( ScrollOfTeleportation.class, 2f );
scrollChances.put( ScrollOfTerror.class, 2f );
scrollChances.put( ScrollOfTransmutation.class, 1f );
}
@Override
protected void onCast(Hero hero) {
detach( curUser.belongings.backpack );
updateQuickslot();
Scroll s = Reflection.newInstance(Random.chances(scrollChances));
s.anonymize();
curItem = s;
s.doRead();
}
@Override
public int price() {
return 40 * quantity;
}
public static class Recipe extends com.shatteredpixel.shatteredpixeldungeon.items.Recipe {
@Override
public boolean testIngredients(ArrayList<Item> ingredients) {
boolean scroll = false;
boolean secondary = false;
for (Item i : ingredients){
if (i instanceof Plant.Seed || i instanceof Runestone){
secondary = true;
//if it is a regular or exotic potion
} else if (ExoticScroll.regToExo.containsKey(i.getClass())
|| ExoticScroll.regToExo.containsValue(i.getClass())) {
scroll = true;
}
}
return scroll && secondary;
}
@Override
public int cost(ArrayList<Item> ingredients) {
for (Item i : ingredients){
if (i instanceof Plant.Seed){
return 2;
} else if (i instanceof Runestone){
return 1;
}
}
return 1;
}
@Override
public Item brew(ArrayList<Item> ingredients) {
for (Item i : ingredients){
i.quantity(i.quantity()-1);
}
return sampleOutput(null);
}
@Override
public Item sampleOutput(ArrayList<Item> ingredients) {
return new ArcaneCatalyst();
}
}
}
| 4,568 | ArcaneCatalyst | java | en | java | code | {"qsc_code_num_words": 493, "qsc_code_num_chars": 4568.0, "qsc_code_mean_word_length": 7.05679513, "qsc_code_frac_words_unique": 0.35496957, "qsc_code_frac_chars_top_2grams": 0.09772923, "qsc_code_frac_chars_top_3grams": 0.21845358, "qsc_code_frac_chars_top_4grams": 0.22765162, "qsc_code_frac_chars_dupe_5grams": 0.30382294, "qsc_code_frac_chars_dupe_6grams": 0.26818051, "qsc_code_frac_chars_dupe_7grams": 0.0428284, "qsc_code_frac_chars_dupe_8grams": 0.02356999, "qsc_code_frac_chars_dupe_9grams": 0.02356999, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00872914, "qsc_code_frac_chars_whitespace": 0.14732925, "qsc_code_size_file_byte": 4568.0, "qsc_code_num_lines": 133.0, "qsc_code_num_chars_line_max": 92.0, "qsc_code_num_chars_line_mean": 34.34586466, "qsc_code_frac_chars_alphabet": 0.88446727, "qsc_code_frac_chars_comments": 0.17885289, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.11827957, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.07526882, "qsc_codejava_score_lines_no_logic": 0.35483871, "qsc_codejava_frac_words_no_modifier": 0.75, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/spells/CurseInfusion.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.spells;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.quest.MetalShard;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRemoveCurse;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.SpiritBow;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
import com.watabou.noosa.audio.Sample;
public class CurseInfusion extends InventorySpell {
{
image = ItemSpriteSheet.CURSE_INFUSE;
mode = WndBag.Mode.CURSABLE;
}
@Override
protected void onItemSelected(Item item) {
CellEmitter.get(curUser.pos).burst(ShadowParticle.UP, 5);
Sample.INSTANCE.play(Assets.SND_CURSED);
item.cursed = true;
if (item instanceof MeleeWeapon || item instanceof SpiritBow) {
Weapon w = (Weapon) item;
if (w.enchantment != null) {
w.enchant(Weapon.Enchantment.randomCurse(w.enchantment.getClass()));
} else {
w.enchant(Weapon.Enchantment.randomCurse());
}
w.curseInfusionBonus = true;
if (w instanceof MagesStaff){
((MagesStaff) w).updateWand(true);
}
} else if (item instanceof Armor){
Armor a = (Armor) item;
if (a.glyph != null){
a.inscribe(Armor.Glyph.randomCurse(a.glyph.getClass()));
} else {
a.inscribe(Armor.Glyph.randomCurse());
}
a.curseInfusionBonus = true;
} else if (item instanceof Wand){
((Wand) item).curseInfusionBonus = true;
((Wand) item).updateLevel();
}
updateQuickslot();
}
@Override
public int price() {
//prices of ingredients, divided by output quantity
return Math.round(quantity * ((30 + 100) / 3f));
}
public static class Recipe extends com.shatteredpixel.shatteredpixeldungeon.items.Recipe.SimpleRecipe {
{
inputs = new Class[]{ScrollOfRemoveCurse.class, MetalShard.class};
inQuantity = new int[]{1, 1};
cost = 4;
output = CurseInfusion.class;
outQuantity = 3;
}
}
}
| 3,401 | CurseInfusion | java | en | java | code | {"qsc_code_num_words": 394, "qsc_code_num_chars": 3401.0, "qsc_code_mean_word_length": 6.52791878, "qsc_code_frac_words_unique": 0.43654822, "qsc_code_frac_chars_top_2grams": 0.10575428, "qsc_code_frac_chars_top_3grams": 0.23639191, "qsc_code_frac_chars_top_4grams": 0.23950233, "qsc_code_frac_chars_dupe_5grams": 0.3277605, "qsc_code_frac_chars_dupe_6grams": 0.16407465, "qsc_code_frac_chars_dupe_7grams": 0.0466563, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00960219, "qsc_code_frac_chars_whitespace": 0.14260512, "qsc_code_size_file_byte": 3401.0, "qsc_code_num_lines": 99.0, "qsc_code_num_chars_line_max": 105.0, "qsc_code_num_chars_line_mean": 34.35353535, "qsc_code_frac_chars_alphabet": 0.87242798, "qsc_code_frac_chars_comments": 0.2443399, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.06153846, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.03076923, "qsc_codejava_score_lines_no_logic": 0.27692308, "qsc_codejava_frac_words_no_modifier": 0.66666667, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/spells/MagicalInfusion.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.spells;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
public class MagicalInfusion extends InventorySpell {
{
mode = WndBag.Mode.UPGRADEABLE;
image = ItemSpriteSheet.MAGIC_INFUSE;
}
@Override
protected void onItemSelected( Item item ) {
if (item instanceof Weapon && ((Weapon) item).enchantment != null && !((Weapon) item).hasCurseEnchant()) {
((Weapon) item).upgrade(true);
} else if (item instanceof Armor && ((Armor) item).glyph != null && !((Armor) item).hasCurseGlyph()) {
((Armor) item).upgrade(true);
} else {
item.upgrade();
}
GLog.p( Messages.get(this, "infuse", item.name()) );
Badges.validateItemLevelAquired(item);
curUser.sprite.emitter().start(Speck.factory(Speck.UP), 0.2f, 3);
Statistics.upgradesUsed++;
}
@Override
public int price() {
//prices of ingredients, divided by output quantity
return Math.round(quantity * ((50 + 40) / 1f));
}
public static class Recipe extends com.shatteredpixel.shatteredpixeldungeon.items.Recipe.SimpleRecipe {
{
inputs = new Class[]{ScrollOfUpgrade.class, ArcaneCatalyst.class};
inQuantity = new int[]{1, 1};
cost = 4;
output = MagicalInfusion.class;
outQuantity = 1;
}
}
}
| 2,727 | MagicalInfusion | java | en | java | code | {"qsc_code_num_words": 319, "qsc_code_num_chars": 2727.0, "qsc_code_mean_word_length": 6.4169279, "qsc_code_frac_words_unique": 0.5015674, "qsc_code_frac_chars_top_2grams": 0.10796287, "qsc_code_frac_chars_top_3grams": 0.24132877, "qsc_code_frac_chars_top_4grams": 0.23644358, "qsc_code_frac_chars_dupe_5grams": 0.1358085, "qsc_code_frac_chars_dupe_6grams": 0.02735711, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01244101, "qsc_code_frac_chars_whitespace": 0.14521452, "qsc_code_size_file_byte": 2727.0, "qsc_code_num_lines": 80.0, "qsc_code_num_chars_line_max": 109.0, "qsc_code_num_chars_line_mean": 34.0875, "qsc_code_frac_chars_alphabet": 0.86572287, "qsc_code_frac_chars_comments": 0.30509718, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.04444444, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00316623, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.04444444, "qsc_codejava_score_lines_no_logic": 0.31111111, "qsc_codejava_frac_words_no_modifier": 0.66666667, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/spells/PhaseShift.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.spells;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
public class PhaseShift extends TargetedSpell {
{
image = ItemSpriteSheet.PHASE_SHIFT;
}
@Override
protected void affectTarget(Ballistica bolt, Hero hero) {
final Char ch = Actor.findChar(bolt.collisionPos);
if (ch == hero){
ScrollOfTeleportation.teleportHero(curUser);
} else if (ch != null) {
int count = 10;
int pos;
do {
pos = Dungeon.level.randomRespawnCell();
if (count-- <= 0) {
break;
}
} while (pos == -1);
if (pos == -1 || Dungeon.bossLevel()) {
GLog.w( Messages.get(ScrollOfTeleportation.class, "no_tele") );
} else if (ch.properties().contains(Char.Property.IMMOVABLE)) {
GLog.w( Messages.get(this, "tele_fail") );
} else {
ch.pos = pos;
if (ch instanceof Mob && ((Mob) ch).state == ((Mob) ch).HUNTING){
((Mob) ch).state = ((Mob) ch).WANDERING;
}
ch.sprite.place(ch.pos);
ch.sprite.visible = Dungeon.level.heroFOV[pos];
}
}
}
@Override
public int price() {
//prices of ingredients, divided by output quantity
return Math.round(quantity * ((30 + 40) / 8f));
}
public static class Recipe extends com.shatteredpixel.shatteredpixeldungeon.items.Recipe.SimpleRecipe {
{
inputs = new Class[]{ScrollOfTeleportation.class, ArcaneCatalyst.class};
inQuantity = new int[]{1, 1};
cost = 6;
output = PhaseShift.class;
outQuantity = 8;
}
}
}
| 2,936 | PhaseShift | java | en | java | code | {"qsc_code_num_words": 348, "qsc_code_num_chars": 2936.0, "qsc_code_mean_word_length": 6.02873563, "qsc_code_frac_words_unique": 0.49425287, "qsc_code_frac_chars_top_2grams": 0.09723546, "qsc_code_frac_chars_top_3grams": 0.21734986, "qsc_code_frac_chars_top_4grams": 0.20972355, "qsc_code_frac_chars_dupe_5grams": 0.14871306, "qsc_code_frac_chars_dupe_6grams": 0.02669209, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01284176, "qsc_code_frac_chars_whitespace": 0.17779292, "qsc_code_size_file_byte": 2936.0, "qsc_code_num_lines": 98.0, "qsc_code_num_chars_line_max": 105.0, "qsc_code_num_chars_line_mean": 29.95918367, "qsc_code_frac_chars_alphabet": 0.85625518, "qsc_code_frac_chars_comments": 0.28303815, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.03508772, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00760095, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.03508772, "qsc_codejava_score_lines_no_logic": 0.24561404, "qsc_codejava_frac_words_no_modifier": 0.66666667, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/spells/TargetedSpell.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.spells;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.CellSelector;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.ui.QuickSlotButton;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Callback;
public abstract class TargetedSpell extends Spell {
protected int collisionProperties = Ballistica.PROJECTILE;
@Override
protected void onCast(Hero hero) {
GameScene.selectCell(targeter);
}
protected abstract void affectTarget( Ballistica bolt, Hero hero );
protected void fx( Ballistica bolt, Callback callback ) {
MagicMissile.boltFromChar( curUser.sprite.parent,
MagicMissile.MAGIC_MISSILE,
curUser.sprite,
bolt.collisionPos,
callback);
Sample.INSTANCE.play( Assets.SND_ZAP );
}
private static CellSelector.Listener targeter = new CellSelector.Listener(){
@Override
public void onSelect( Integer target ) {
if (target != null) {
//FIXME this safety check shouldn't be necessary
//it would be better to eliminate the curItem static variable.
final TargetedSpell curSpell;
if (curItem instanceof TargetedSpell) {
curSpell = (TargetedSpell)curItem;
} else {
return;
}
final Ballistica shot = new Ballistica( curUser.pos, target, curSpell.collisionProperties);
int cell = shot.collisionPos;
curUser.sprite.zap(cell);
//attempts to target the cell aimed at if something is there, otherwise targets the collision pos.
if (Actor.findChar(target) != null)
QuickSlotButton.target(Actor.findChar(target));
else
QuickSlotButton.target(Actor.findChar(cell));
curUser.busy();
Invisibility.dispel();
curSpell.fx(shot, new Callback() {
public void call() {
curSpell.affectTarget(shot, curUser);
curSpell.detach( curUser.belongings.backpack );
curSpell.updateQuickslot();
curUser.spendAndNext( 1f );
}
});
}
}
@Override
public String prompt() {
return Messages.get(TargetedSpell.class, "prompt");
}
};
}
| 3,415 | TargetedSpell | java | en | java | code | {"qsc_code_num_words": 386, "qsc_code_num_chars": 3415.0, "qsc_code_mean_word_length": 6.56735751, "qsc_code_frac_words_unique": 0.47409326, "qsc_code_frac_chars_top_2grams": 0.04260355, "qsc_code_frac_chars_top_3grams": 0.16489152, "qsc_code_frac_chars_top_4grams": 0.17357002, "qsc_code_frac_chars_dupe_5grams": 0.13096647, "qsc_code_frac_chars_dupe_6grams": 0.02209073, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00637168, "qsc_code_frac_chars_whitespace": 0.1727672, "qsc_code_size_file_byte": 3415.0, "qsc_code_num_lines": 106.0, "qsc_code_num_chars_line_max": 103.0, "qsc_code_num_chars_line_mean": 32.21698113, "qsc_code_frac_chars_alphabet": 0.89097345, "qsc_code_frac_chars_comments": 0.28931186, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.04761905, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00247219, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.00943396, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.07936508, "qsc_codejava_score_lines_no_logic": 0.31746032, "qsc_codejava_frac_words_no_modifier": 0.83333333, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/spells/Alchemize.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.spells;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.AlchemicalCatalyst;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.AlchemyScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
public class Alchemize extends Spell implements AlchemyScene.AlchemyProvider {
{
image = ItemSpriteSheet.ALCHEMIZE;
}
@Override
protected void onCast(Hero hero) {
if (hero.visibleEnemies() > hero.mindVisionEnemies.size()) {
GLog.i( Messages.get(this, "enemy_near") );
return;
}
detach( curUser.belongings.backpack );
updateQuickslot();
AlchemyScene.setProvider(this);
ShatteredPixelDungeon.switchScene(AlchemyScene.class);
}
@Override
public int getEnergy() {
return 0;
}
@Override
public void spendEnergy(int reduction) {
//do nothing
}
@Override
public int price() {
//prices of ingredients, divided by output quantity
return Math.round(quantity * ((40 + 40) / 4f));
}
public static class Recipe extends com.shatteredpixel.shatteredpixeldungeon.items.Recipe.SimpleRecipe {
{
inputs = new Class[]{ArcaneCatalyst.class, AlchemicalCatalyst.class};
inQuantity = new int[]{1, 1};
cost = 6;
output = Alchemize.class;
outQuantity = 4;
}
}
}
| 2,361 | Alchemize | java | en | java | code | {"qsc_code_num_words": 275, "qsc_code_num_chars": 2361.0, "qsc_code_mean_word_length": 6.48363636, "qsc_code_frac_words_unique": 0.54909091, "qsc_code_frac_chars_top_2grams": 0.08581043, "qsc_code_frac_chars_top_3grams": 0.19181155, "qsc_code_frac_chars_top_4grams": 0.17274257, "qsc_code_frac_chars_dupe_5grams": 0.0459899, "qsc_code_frac_chars_dupe_6grams": 0.03140774, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01355422, "qsc_code_frac_chars_whitespace": 0.15628971, "qsc_code_size_file_byte": 2361.0, "qsc_code_num_lines": 79.0, "qsc_code_num_chars_line_max": 105.0, "qsc_code_num_chars_line_mean": 29.88607595, "qsc_code_frac_chars_alphabet": 0.8815261, "qsc_code_frac_chars_comments": 0.3570521, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.09090909, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00658762, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.09090909, "qsc_codejava_score_lines_no_logic": 0.31818182, "qsc_codejava_frac_words_no_modifier": 0.8, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/spells/Spell.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.spells;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import java.util.ArrayList;
public abstract class Spell extends Item {
public static final String AC_CAST = "CAST";
{
stackable = true;
defaultAction = AC_CAST;
}
@Override
public ArrayList<String> actions(Hero hero ) {
ArrayList<String> actions = super.actions( hero );
actions.add( AC_CAST );
return actions;
}
@Override
public void execute( final Hero hero, String action ) {
super.execute( hero, action );
if (action.equals( AC_CAST )) {
if (curUser.buff(MagicImmune.class) != null){
GLog.w( Messages.get(this, "no_magic") );
return;
}
onCast( hero );
}
}
@Override
public boolean isIdentified() {
return true;
}
@Override
public boolean isUpgradable() {
return false;
}
protected abstract void onCast(Hero hero );
}
| 1,984 | Spell | java | en | java | code | {"qsc_code_num_words": 252, "qsc_code_num_chars": 1984.0, "qsc_code_mean_word_length": 5.73809524, "qsc_code_frac_words_unique": 0.51587302, "qsc_code_frac_chars_top_2grams": 0.07053942, "qsc_code_frac_chars_top_3grams": 0.15767635, "qsc_code_frac_chars_top_4grams": 0.15214385, "qsc_code_frac_chars_dupe_5grams": 0.12586445, "qsc_code_frac_chars_dupe_6grams": 0.03872752, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01046798, "qsc_code_frac_chars_whitespace": 0.18145161, "qsc_code_size_file_byte": 1984.0, "qsc_code_num_lines": 78.0, "qsc_code_num_chars_line_max": 74.0, "qsc_code_num_chars_line_mean": 25.43589744, "qsc_code_frac_chars_alphabet": 0.87992611, "qsc_code_frac_chars_comments": 0.39314516, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.1, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00996678, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.075, "qsc_codejava_score_lines_no_logic": 0.35, "qsc_codejava_frac_words_no_modifier": 0.75, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 1 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/Ring.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.rings;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.ItemStatusHandler;
import com.shatteredpixel.shatteredpixeldungeon.items.KindofMisc;
import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.utils.Bundle;
import com.watabou.utils.Random;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
public class Ring extends KindofMisc {
protected Buff buff;
private static final Class<?>[] rings = {
RingOfAccuracy.class,
RingOfEvasion.class,
RingOfElements.class,
RingOfForce.class,
RingOfFuror.class,
RingOfHaste.class,
RingOfEnergy.class,
RingOfMight.class,
RingOfSharpshooting.class,
RingOfTenacity.class,
RingOfWealth.class,
};
private static final HashMap<String, Integer> gems = new HashMap<String, Integer>() {
{
put("garnet",ItemSpriteSheet.RING_GARNET);
put("ruby",ItemSpriteSheet.RING_RUBY);
put("topaz",ItemSpriteSheet.RING_TOPAZ);
put("emerald",ItemSpriteSheet.RING_EMERALD);
put("onyx",ItemSpriteSheet.RING_ONYX);
put("opal",ItemSpriteSheet.RING_OPAL);
put("tourmaline",ItemSpriteSheet.RING_TOURMALINE);
put("sapphire",ItemSpriteSheet.RING_SAPPHIRE);
put("amethyst",ItemSpriteSheet.RING_AMETHYST);
put("quartz",ItemSpriteSheet.RING_QUARTZ);
put("agate",ItemSpriteSheet.RING_AGATE);
put("diamond",ItemSpriteSheet.RING_DIAMOND);
}
};
private static ItemStatusHandler<Ring> handler;
private String gem;
//rings cannot be 'used' like other equipment, so they ID purely based on exp
private float levelsToID = 1;
@SuppressWarnings("unchecked")
public static void initGems() {
handler = new ItemStatusHandler<>( (Class<? extends Ring>[])rings, gems );
}
public static void save( Bundle bundle ) {
handler.save( bundle );
}
public static void saveSelectively( Bundle bundle, ArrayList<Item> items ) {
handler.saveSelectively( bundle, items );
}
@SuppressWarnings("unchecked")
public static void restore( Bundle bundle ) {
handler = new ItemStatusHandler<>( (Class<? extends Ring>[])rings, gems, bundle );
}
public Ring() {
super();
reset();
}
//anonymous rings are always IDed, do not affect ID status,
//and their sprite is replaced by a placeholder if they are not known,
//useful for items that appear in UIs, or which are only spawned for their effects
protected boolean anonymous = false;
public void anonymize(){
if (!isKnown()) image = ItemSpriteSheet.RING_HOLDER;
anonymous = true;
}
public void reset() {
super.reset();
levelsToID = 1;
if (handler != null && handler.contains(this)){
image = handler.image(this);
gem = handler.label(this);
}
}
public void activate( Char ch ) {
buff = buff();
buff.attachTo( ch );
}
@Override
public boolean doUnequip( Hero hero, boolean collect, boolean single ) {
if (super.doUnequip( hero, collect, single )) {
hero.remove( buff );
buff = null;
return true;
} else {
return false;
}
}
public boolean isKnown() {
return anonymous || (handler != null && handler.isKnown( this ));
}
public void setKnown() {
if (!anonymous) {
if (!isKnown()) {
handler.know(this);
}
if (Dungeon.hero.isAlive()) {
Catalog.setSeen(getClass());
}
}
}
@Override
public String name() {
return isKnown() ? super.name() : Messages.get(Ring.class, gem);
}
@Override
public String info(){
String desc = isKnown() ? super.desc() : Messages.get(this, "unknown_desc");
if (cursed && isEquipped( Dungeon.hero )) {
desc += "\n\n" + Messages.get(Ring.class, "cursed_worn");
} else if (cursed && cursedKnown) {
desc += "\n\n" + Messages.get(Ring.class, "curse_known");
} else if (!isIdentified() && cursedKnown){
desc += "\n\n" + Messages.get(Ring.class, "not_cursed");
}
if (isKnown()) {
desc += "\n\n" + statsInfo();
}
return desc;
}
protected String statsInfo(){
return "";
}
@Override
public Item upgrade() {
super.upgrade();
if (Random.Int(3) == 0) {
cursed = false;
}
return this;
}
@Override
public boolean isIdentified() {
return super.isIdentified() && isKnown();
}
@Override
public Item identify() {
setKnown();
levelsToID = 0;
return super.identify();
}
@Override
public Item random() {
//+0: 66.67% (2/3)
//+1: 26.67% (4/15)
//+2: 6.67% (1/15)
int n = 0;
if (Random.Int(3) == 0) {
n++;
if (Random.Int(5) == 0){
n++;
}
}
level(n);
//30% chance to be cursed
if (Random.Float() < 0.3f) {
cursed = true;
}
return this;
}
public static HashSet<Class<? extends Ring>> getKnown() {
return handler.known();
}
public static HashSet<Class<? extends Ring>> getUnknown() {
return handler.unknown();
}
public static boolean allKnown() {
return handler.known().size() == rings.length - 2;
}
@Override
public int price() {
int price = 75;
if (cursed && cursedKnown) {
price /= 2;
}
if (levelKnown) {
if (level() > 0) {
price *= (level() + 1);
} else if (level() < 0) {
price /= (1 - level());
}
}
if (price < 1) {
price = 1;
}
return price;
}
protected RingBuff buff() {
return null;
}
private static final String LEVELS_TO_ID = "levels_to_ID";
@Override
public void storeInBundle( Bundle bundle ) {
super.storeInBundle( bundle );
bundle.put( LEVELS_TO_ID, levelsToID );
}
@Override
public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle( bundle );
levelsToID = bundle.getFloat( LEVELS_TO_ID );
//pre-0.7.2 saves
if (bundle.contains( "unfamiliarity" )){
levelsToID = bundle.getInt( "unfamiliarity" ) / 200f;
}
}
public void onHeroGainExp( float levelPercent, Hero hero ){
if (isIdentified() || !isEquipped(hero)) return;
//becomes IDed after 1 level
levelsToID -= levelPercent;
if (levelsToID <= 0){
identify();
GLog.p( Messages.get(Ring.class, "identify", toString()) );
Badges.validateItemLevelAquired( this );
}
}
public static int getBonus(Char target, Class<?extends RingBuff> type){
int bonus = 0;
for (RingBuff buff : target.buffs(type)) {
bonus += buff.level();
}
return bonus;
}
public int soloBonus(){
if (cursed){
return Math.min( 0, Ring.this.level()-2 );
} else {
return Ring.this.level()+1;
}
}
public class RingBuff extends Buff {
@Override
public boolean act() {
spend( TICK );
return true;
}
public int level(){
return Ring.this.soloBonus();
}
}
}
| 7,925 | Ring | java | en | java | code | {"qsc_code_num_words": 930, "qsc_code_num_chars": 7925.0, "qsc_code_mean_word_length": 5.78602151, "qsc_code_frac_words_unique": 0.3, "qsc_code_frac_chars_top_2grams": 0.02341572, "qsc_code_frac_chars_top_3grams": 0.0918045, "qsc_code_frac_chars_top_4grams": 0.09812303, "qsc_code_frac_chars_dupe_5grams": 0.14142353, "qsc_code_frac_chars_dupe_6grams": 0.06132689, "qsc_code_frac_chars_dupe_7grams": 0.03791117, "qsc_code_frac_chars_dupe_8grams": 0.03307935, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01165682, "qsc_code_frac_chars_whitespace": 0.1881388, "qsc_code_size_file_byte": 7925.0, "qsc_code_num_lines": 335.0, "qsc_code_num_chars_line_max": 87.0, "qsc_code_num_chars_line_mean": 23.65671642, "qsc_code_frac_chars_alphabet": 0.82468138, "qsc_code_frac_chars_comments": 0.15078864, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.10288066, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.02942051, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.11522634, "qsc_codejava_score_lines_no_logic": 0.24691358, "qsc_codejava_frac_words_no_modifier": 0.9, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 1 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfTenacity.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.rings;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import java.text.DecimalFormat;
public class RingOfTenacity extends Ring {
public String statsInfo() {
if (isIdentified()){
return Messages.get(this, "stats", new DecimalFormat("#.##").format(100f * (1f - Math.pow(0.85f, soloBonus()))));
} else {
return Messages.get(this, "typical_stats", new DecimalFormat("#.##").format(15f));
}
}
@Override
protected RingBuff buff( ) {
return new Tenacity();
}
public static float damageMultiplier( Char t ){
//(HT - HP)/HT = heroes current % missing health.
return (float)Math.pow(0.85, getBonus( t, Tenacity.class)*((float)(t.HT - t.HP)/t.HT));
}
public class Tenacity extends RingBuff {
}
}
| 1,640 | RingOfTenacity | java | en | java | code | {"qsc_code_num_words": 221, "qsc_code_num_chars": 1640.0, "qsc_code_mean_word_length": 5.36651584, "qsc_code_frac_words_unique": 0.58823529, "qsc_code_frac_chars_top_2grams": 0.02782462, "qsc_code_frac_chars_top_3grams": 0.03288364, "qsc_code_frac_chars_top_4grams": 0.04806071, "qsc_code_frac_chars_dupe_5grams": 0.06913997, "qsc_code_frac_chars_dupe_6grams": 0.04721754, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.02124542, "qsc_code_frac_chars_whitespace": 0.16768293, "qsc_code_size_file_byte": 1640.0, "qsc_code_num_lines": 51.0, "qsc_code_num_chars_line_max": 117.0, "qsc_code_num_chars_line_mean": 32.15686275, "qsc_code_frac_chars_alphabet": 0.84761905, "qsc_code_frac_chars_comments": 0.50609756, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.0, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.03213844, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.13636364, "qsc_codejava_score_lines_no_logic": 0.36363636, "qsc_codejava_frac_words_no_modifier": 0.6, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfSharpshooting.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.rings;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import java.text.DecimalFormat;
public class RingOfSharpshooting extends Ring {
public String statsInfo() {
if (isIdentified()){
return Messages.get(this, "stats", soloBonus(), new DecimalFormat("#.##").format(100f * (Math.pow(1.2, soloBonus()) - 1f)));
} else {
return Messages.get(this, "typical_stats", 1, new DecimalFormat("#.##").format(20f));
}
}
@Override
protected RingBuff buff( ) {
return new Aim();
}
public static int levelDamageBonus( Char target ){
return getBonus(target, RingOfSharpshooting.Aim.class);
}
public static float durabilityMultiplier( Char target ){
return (float)(Math.pow(1.2, getBonus(target, Aim.class)));
}
public class Aim extends RingBuff {
}
}
| 1,693 | RingOfSharpshooting | java | en | java | code | {"qsc_code_num_words": 221, "qsc_code_num_chars": 1693.0, "qsc_code_mean_word_length": 5.60633484, "qsc_code_frac_words_unique": 0.56561086, "qsc_code_frac_chars_top_2grams": 0.02663438, "qsc_code_frac_chars_top_3grams": 0.031477, "qsc_code_frac_chars_top_4grams": 0.04600484, "qsc_code_frac_chars_dupe_5grams": 0.06618241, "qsc_code_frac_chars_dupe_6grams": 0.04519774, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01981599, "qsc_code_frac_chars_whitespace": 0.16538689, "qsc_code_size_file_byte": 1693.0, "qsc_code_num_lines": 53.0, "qsc_code_num_chars_line_max": 128.0, "qsc_code_num_chars_line_mean": 31.94339623, "qsc_code_frac_chars_alphabet": 0.85704176, "qsc_code_frac_chars_comments": 0.46131128, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.0, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.02850877, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.2, "qsc_codejava_score_lines_no_logic": 0.4, "qsc_codejava_frac_words_no_modifier": 0.57142857, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfMight.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.rings;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import java.text.DecimalFormat;
public class RingOfMight extends Ring {
@Override
public boolean doEquip(Hero hero) {
if (super.doEquip(hero)){
hero.updateHT( false );
return true;
} else {
return false;
}
}
@Override
public boolean doUnequip(Hero hero, boolean collect, boolean single) {
if (super.doUnequip(hero, collect, single)){
hero.updateHT( false );
return true;
} else {
return false;
}
}
@Override
public Item upgrade() {
super.upgrade();
updateTargetHT();
return this;
}
@Override
public void level(int value) {
super.level(value);
updateTargetHT();
}
private void updateTargetHT(){
if (buff != null && buff.target instanceof Hero){
((Hero) buff.target).updateHT( false );
}
}
public String statsInfo() {
if (isIdentified()){
return Messages.get(this, "stats", soloBonus(), new DecimalFormat("#.##").format(100f * (Math.pow(1.035, soloBonus()) - 1f)));
} else {
return Messages.get(this, "typical_stats", 1, new DecimalFormat("#.##").format(3.5f));
}
}
@Override
protected RingBuff buff( ) {
return new Might();
}
public static int strengthBonus( Char target ){
return getBonus( target, Might.class );
}
public static float HTMultiplier( Char target ){
return (float)Math.pow(1.035, getBonus(target, Might.class));
}
public class Might extends RingBuff {
}
}
| 2,477 | RingOfMight | java | en | java | code | {"qsc_code_num_words": 310, "qsc_code_num_chars": 2477.0, "qsc_code_mean_word_length": 5.7, "qsc_code_frac_words_unique": 0.46451613, "qsc_code_frac_chars_top_2grams": 0.04810413, "qsc_code_frac_chars_top_3grams": 0.10752688, "qsc_code_frac_chars_top_4grams": 0.09960385, "qsc_code_frac_chars_dupe_5grams": 0.20033956, "qsc_code_frac_chars_dupe_6grams": 0.0950764, "qsc_code_frac_chars_dupe_7grams": 0.06338427, "qsc_code_frac_chars_dupe_8grams": 0.06338427, "qsc_code_frac_chars_dupe_9grams": 0.06338427, "qsc_code_frac_chars_dupe_10grams": 0.06338427, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01567859, "qsc_code_frac_chars_whitespace": 0.17601938, "qsc_code_size_file_byte": 2477.0, "qsc_code_num_lines": 96.0, "qsc_code_num_chars_line_max": 130.0, "qsc_code_num_chars_line_mean": 25.80208333, "qsc_code_frac_chars_alphabet": 0.85007349, "qsc_code_frac_chars_comments": 0.31530077, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.26229508, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.01533923, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.16393443, "qsc_codejava_score_lines_no_logic": 0.36065574, "qsc_codejava_frac_words_no_modifier": 0.75, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfHaste.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.rings;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import java.text.DecimalFormat;
public class RingOfHaste extends Ring {
public String statsInfo() {
if (isIdentified()){
return Messages.get(this, "stats", new DecimalFormat("#.##").format(100f * (Math.pow(1.2f, soloBonus()) - 1f)));
} else {
return Messages.get(this, "typical_stats", new DecimalFormat("#.##").format(20f));
}
}
@Override
protected RingBuff buff( ) {
return new Haste();
}
public static float speedMultiplier( Char target ){
return (float)Math.pow(1.2, getBonus(target, Haste.class));
}
public class Haste extends RingBuff {
}
}
| 1,555 | RingOfHaste | java | en | java | code | {"qsc_code_num_words": 207, "qsc_code_num_chars": 1555.0, "qsc_code_mean_word_length": 5.48309179, "qsc_code_frac_words_unique": 0.59903382, "qsc_code_frac_chars_top_2grams": 0.02907489, "qsc_code_frac_chars_top_3grams": 0.03436123, "qsc_code_frac_chars_top_4grams": 0.05022026, "qsc_code_frac_chars_dupe_5grams": 0.0722467, "qsc_code_frac_chars_dupe_6grams": 0.04933921, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.02088167, "qsc_code_frac_chars_whitespace": 0.16848875, "qsc_code_size_file_byte": 1555.0, "qsc_code_num_lines": 49.0, "qsc_code_num_chars_line_max": 116.0, "qsc_code_num_chars_line_mean": 31.73469388, "qsc_code_frac_chars_alphabet": 0.85692189, "qsc_code_frac_chars_comments": 0.5022508, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.0, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.03359173, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.13636364, "qsc_codejava_score_lines_no_logic": 0.36363636, "qsc_codejava_frac_words_no_modifier": 0.6, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfForce.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.rings;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.watabou.utils.Random;
public class RingOfForce extends Ring {
@Override
protected RingBuff buff( ) {
return new Force();
}
public static int armedDamageBonus( Char ch ){
return getBonus( ch, Force.class);
}
// *** Weapon-like properties ***
private static float tier(int str){
float tier = Math.max(1, (str - 8)/2f);
//each str point after 18 is half as effective
if (tier > 5){
tier = 5 + (tier - 5) / 2f;
}
return tier;
}
public static int damageRoll( Hero hero ){
if (hero.buff(Force.class) != null) {
int level = getBonus(hero, Force.class);
float tier = tier(hero.STR());
return Random.NormalIntRange(min(level, tier), max(level, tier));
} else {
//attack without any ring of force influence
return Random.NormalIntRange(1, Math.max(hero.STR()-8, 1));
}
}
//same as equivalent tier weapon
private static int min(int lvl, float tier){
return Math.max( 0, Math.round(
tier + //base
lvl //level scaling
));
}
//same as equivalent tier weapon
private static int max(int lvl, float tier){
return Math.max( 0, Math.round(
5*(tier+1) + //base
lvl*(tier+1) //level scaling
));
}
@Override
public String statsInfo() {
float tier = tier(Dungeon.hero.STR());
if (isIdentified()) {
return Messages.get(this, "stats", min(soloBonus(), tier), max(soloBonus(), tier), soloBonus());
} else {
return Messages.get(this, "typical_stats", min(1, tier), max(1, tier), 1);
}
}
public class Force extends RingBuff {
}
}
| 2,632 | RingOfForce | java | en | java | code | {"qsc_code_num_words": 360, "qsc_code_num_chars": 2632.0, "qsc_code_mean_word_length": 5.10277778, "qsc_code_frac_words_unique": 0.41388889, "qsc_code_frac_chars_top_2grams": 0.02939575, "qsc_code_frac_chars_top_3grams": 0.1034295, "qsc_code_frac_chars_top_4grams": 0.09580838, "qsc_code_frac_chars_dupe_5grams": 0.18617311, "qsc_code_frac_chars_dupe_6grams": 0.11758302, "qsc_code_frac_chars_dupe_7grams": 0.08709853, "qsc_code_frac_chars_dupe_8grams": 0.08709853, "qsc_code_frac_chars_dupe_9grams": 0.0413718, "qsc_code_frac_chars_dupe_10grams": 0.0413718, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01730589, "qsc_code_frac_chars_whitespace": 0.18768997, "qsc_code_size_file_byte": 2632.0, "qsc_code_num_lines": 92.0, "qsc_code_num_chars_line_max": 100.0, "qsc_code_num_chars_line_mean": 28.60869565, "qsc_code_frac_chars_alphabet": 0.84190833, "qsc_code_frac_chars_comments": 0.3837386, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.14814815, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.01110426, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.14814815, "qsc_codejava_score_lines_no_logic": 0.2962963, "qsc_codejava_frac_words_no_modifier": 0.7, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 1 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfEvasion.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.rings;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import java.text.DecimalFormat;
public class RingOfEvasion extends Ring {
public String statsInfo() {
if (isIdentified()){
return Messages.get(this, "stats", new DecimalFormat("#.##").format(100f * (Math.pow(1.15f, soloBonus()) - 1f)));
} else {
return Messages.get(this, "typical_stats", new DecimalFormat("#.##").format(15f));
}
}
@Override
protected RingBuff buff( ) {
return new Evasion();
}
public static float evasionMultiplier( Char target ){
return (float) Math.pow( 1.15, getBonus(target, Evasion.class));
}
public class Evasion extends RingBuff {
}
}
| 1,568 | RingOfEvasion | java | en | java | code | {"qsc_code_num_words": 207, "qsc_code_num_chars": 1568.0, "qsc_code_mean_word_length": 5.5410628, "qsc_code_frac_words_unique": 0.5942029, "qsc_code_frac_chars_top_2grams": 0.02877071, "qsc_code_frac_chars_top_3grams": 0.03400174, "qsc_code_frac_chars_top_4grams": 0.04969486, "qsc_code_frac_chars_dupe_5grams": 0.07149085, "qsc_code_frac_chars_dupe_6grams": 0.04882302, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.02222222, "qsc_code_frac_chars_whitespace": 0.16772959, "qsc_code_size_file_byte": 1568.0, "qsc_code_num_lines": 49.0, "qsc_code_num_chars_line_max": 117.0, "qsc_code_num_chars_line_mean": 32.0, "qsc_code_frac_chars_alphabet": 0.85670498, "qsc_code_frac_chars_comments": 0.49808673, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.0, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.03303685, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.13636364, "qsc_codejava_score_lines_no_logic": 0.36363636, "qsc_codejava_frac_words_no_modifier": 0.6, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfEnergy.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.rings;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import java.text.DecimalFormat;
public class RingOfEnergy extends Ring {
public String statsInfo() {
if (isIdentified()){
return Messages.get(this, "stats", new DecimalFormat("#.##").format(100f * (Math.pow(1.30f, soloBonus()) - 1f)));
} else {
return Messages.get(this, "typical_stats", new DecimalFormat("#.##").format(30f));
}
}
@Override
protected RingBuff buff( ) {
return new Energy();
}
public static float wandChargeMultiplier( Char target ){
return (float)Math.pow(1.30, getBonus(target, Energy.class));
}
public class Energy extends RingBuff {
}
}
| 1,566 | RingOfEnergy | java | en | java | code | {"qsc_code_num_words": 207, "qsc_code_num_chars": 1566.0, "qsc_code_mean_word_length": 5.53623188, "qsc_code_frac_words_unique": 0.5942029, "qsc_code_frac_chars_top_2grams": 0.02879581, "qsc_code_frac_chars_top_3grams": 0.03403141, "qsc_code_frac_chars_top_4grams": 0.04973822, "qsc_code_frac_chars_dupe_5grams": 0.07155323, "qsc_code_frac_chars_dupe_6grams": 0.04886562, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.02223926, "qsc_code_frac_chars_whitespace": 0.16730524, "qsc_code_size_file_byte": 1566.0, "qsc_code_num_lines": 49.0, "qsc_code_num_chars_line_max": 117.0, "qsc_code_num_chars_line_mean": 31.95918367, "qsc_code_frac_chars_alphabet": 0.85659509, "qsc_code_frac_chars_comments": 0.49872286, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.0, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.03312102, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.13636364, "qsc_codejava_score_lines_no_logic": 0.36363636, "qsc_codejava_frac_words_no_modifier": 0.6, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/scenes/AlchemyScene.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.scenes;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Chrome;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.SPDSettings;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Belongings;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.Recipe;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.AlchemistsToolkit;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.darts.Dart;
import com.shatteredpixel.shatteredpixeldungeon.journal.Journal;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.ui.ExitButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.IconButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
import com.shatteredpixel.shatteredpixeldungeon.ui.ItemSlot;
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndInfoItem;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndJournal;
import com.watabou.gltextures.TextureCache;
import com.watabou.glwrap.Blending;
import com.watabou.noosa.Camera;
import com.watabou.noosa.ColorBlock;
import com.watabou.noosa.Game;
import com.watabou.noosa.Image;
import com.watabou.noosa.NinePatch;
import com.watabou.noosa.NoosaScript;
import com.watabou.noosa.NoosaScriptNoLighting;
import com.watabou.noosa.SkinnedBlock;
import com.watabou.noosa.audio.Sample;
import com.watabou.noosa.particles.Emitter;
import com.watabou.noosa.ui.Component;
import java.io.IOException;
import java.util.ArrayList;
public class AlchemyScene extends PixelScene {
private static ItemButton[] inputs = new ItemButton[3];
private ItemSlot output;
private Emitter smokeEmitter;
private Emitter bubbleEmitter;
private Emitter lowerBubbles;
private SkinnedBlock water;
private RenderedTextBlock energyLeft;
private RenderedTextBlock energyCost;
private RedButton btnCombine;
private static final int BTN_SIZE = 28;
@Override
public void create() {
super.create();
water = new SkinnedBlock(
Camera.main.width, Camera.main.height,
Dungeon.level.waterTex() ){
@Override
protected NoosaScript script() {
return NoosaScriptNoLighting.get();
}
@Override
public void draw() {
//water has no alpha component, this improves performance
Blending.disable();
super.draw();
Blending.enable();
}
};
add(water);
Image im = new Image(TextureCache.createGradient(0x66000000, 0x88000000, 0xAA000000, 0xCC000000, 0xFF000000));
im.angle = 90;
im.x = Camera.main.width;
im.scale.x = Camera.main.height/5f;
im.scale.y = Camera.main.width;
add(im);
RenderedTextBlock title = PixelScene.renderTextBlock( Messages.get(this, "title"), 9 );
title.hardlight(Window.TITLE_COLOR);
title.setPos(
(Camera.main.width - title.width()) / 2f,
(20 - title.height()) / 2f
);
align(title);
add(title);
int w = 50 + Camera.main.width/2;
int left = (Camera.main.width - w)/2;
int pos = (Camera.main.height - 100)/2;
RenderedTextBlock desc = PixelScene.renderTextBlock(6);
desc.maxWidth(w);
desc.text( Messages.get(AlchemyScene.class, "text") );
desc.setPos(left + (w - desc.width())/2, pos);
add(desc);
pos += desc.height() + 6;
synchronized (inputs) {
for (int i = 0; i < inputs.length; i++) {
inputs[i] = new ItemButton() {
@Override
protected void onClick() {
super.onClick();
if (item != null) {
if (!(item instanceof AlchemistsToolkit)) {
if (!item.collect()) {
Dungeon.level.drop(item, Dungeon.hero.pos);
}
}
item = null;
slot.item(new WndBag.Placeholder(ItemSpriteSheet.SOMETHING));
updateState();
}
AlchemyScene.this.addToFront(WndBag.lastBag( itemSelector, WndBag.Mode.ALCHEMY, Messages.get(AlchemyScene.class, "select")));
}
};
inputs[i].setRect(left + 10, pos, BTN_SIZE, BTN_SIZE);
add(inputs[i]);
pos += BTN_SIZE + 2;
}
}
btnCombine = new RedButton(""){
Image arrow;
@Override
protected void createChildren() {
super.createChildren();
arrow = Icons.get(Icons.ARROW);
add(arrow);
}
@Override
protected void layout() {
super.layout();
arrow.x = x + (width - arrow.width)/2f;
arrow.y = y + (height - arrow.height)/2f;
PixelScene.align(arrow);
}
@Override
public void enable(boolean value) {
super.enable(value);
if (value){
arrow.tint(1, 1, 0, 1);
arrow.alpha(1f);
bg.alpha(1f);
} else {
arrow.color(0, 0, 0);
arrow.alpha(0.6f);
bg.alpha(0.6f);
}
}
@Override
protected void onClick() {
super.onClick();
combine();
}
};
btnCombine.enable(false);
btnCombine.setRect(left + (w-30)/2f, inputs[1].top()+5, 30, inputs[1].height()-10);
add(btnCombine);
output = new ItemSlot(){
@Override
protected void onClick() {
super.onClick();
if (visible && item.trueName() != null){
AlchemyScene.this.addToFront(new WndInfoItem(item));
}
}
};
output.setRect(left + w - BTN_SIZE - 10, inputs[1].top(), BTN_SIZE, BTN_SIZE);
ColorBlock outputBG = new ColorBlock(output.width(), output.height(), 0x9991938C);
outputBG.x = output.left();
outputBG.y = output.top();
add(outputBG);
add(output);
output.visible = false;
bubbleEmitter = new Emitter();
smokeEmitter = new Emitter();
bubbleEmitter.pos(0, 0, Camera.main.width, Camera.main.height);
smokeEmitter.pos(outputBG.x + (BTN_SIZE-16)/2f, outputBG.y + (BTN_SIZE-16)/2f, 16, 16);
bubbleEmitter.autoKill = false;
smokeEmitter.autoKill = false;
add(bubbleEmitter);
add(smokeEmitter);
pos += 10;
lowerBubbles = new Emitter();
lowerBubbles.pos(0, pos, Camera.main.width, Math.max(0, Camera.main.height-pos));
add(lowerBubbles);
lowerBubbles.pour(Speck.factory( Speck.BUBBLE ), 0.1f );
ExitButton btnExit = new ExitButton(){
@Override
protected void onClick() {
Game.switchScene(GameScene.class);
}
};
btnExit.setPos( Camera.main.width - btnExit.width(), 0 );
add( btnExit );
IconButton btnGuide = new IconButton( new ItemSprite(ItemSpriteSheet.ALCH_PAGE, null)){
@Override
protected void onClick() {
super.onClick();
clearSlots();
updateState();
AlchemyScene.this.addToFront(new Window(){
{
WndJournal.AlchemyTab t = new WndJournal.AlchemyTab();
int w, h;
if (SPDSettings.landscape()) {
w = WndJournal.WIDTH_L; h = WndJournal.HEIGHT_L;
} else {
w = WndJournal.WIDTH_P; h = WndJournal.HEIGHT_P;
}
resize(w, h);
add(t);
t.setRect(0, 0, w, h);
}
});
}
};
btnGuide.setRect(0, 0, 20, 20);
add(btnGuide);
energyLeft = PixelScene.renderTextBlock(Messages.get(AlchemyScene.class, "energy", availableEnergy()), 9);
energyLeft.setPos(
(Camera.main.width - energyLeft.width())/2,
Camera.main.height - 5 - energyLeft.height()
);
add(energyLeft);
energyCost = PixelScene.renderTextBlock(6);
add(energyCost);
fadeIn();
try {
Dungeon.saveAll();
Badges.saveGlobal();
Journal.saveGlobal();
} catch (IOException e) {
ShatteredPixelDungeon.reportException(e);
}
}
@Override
public void update() {
super.update();
water.offset( 0, -5 * Game.elapsed );
}
@Override
protected void onBackPressed() {
Game.switchScene(GameScene.class);
}
protected WndBag.Listener itemSelector = new WndBag.Listener() {
@Override
public void onSelect( Item item ) {
synchronized (inputs) {
if (item != null && inputs[0] != null) {
for (int i = 0; i < inputs.length; i++) {
if (inputs[i].item == null) {
if (item instanceof Dart) {
inputs[i].item(item.detachAll(Dungeon.hero.belongings.backpack));
} else if (item instanceof AlchemistsToolkit) {
clearSlots();
inputs[i].item(item);
} else {
inputs[i].item(item.detach(Dungeon.hero.belongings.backpack));
}
break;
}
}
updateState();
}
}
}
};
private<T extends Item> ArrayList<T> filterInput(Class<? extends T> itemClass){
ArrayList<T> filtered = new ArrayList<>();
for (int i = 0; i < inputs.length; i++){
Item item = inputs[i].item;
if (item != null && itemClass.isInstance(item)){
filtered.add((T)item);
}
}
return filtered;
}
private void updateState(){
ArrayList<Item> ingredients = filterInput(Item.class);
Recipe recipe = Recipe.findRecipe(ingredients);
if (recipe != null){
int cost = recipe.cost(ingredients);
output.item(recipe.sampleOutput(ingredients));
output.visible = true;
energyCost.text( Messages.get(AlchemyScene.class, "cost", cost) );
energyCost.setPos(
btnCombine.left() + (btnCombine.width() - energyCost.width())/2,
btnCombine.top() - energyCost.height()
);
energyCost.visible = (cost > 0);
if (cost <= availableEnergy()) {
btnCombine.enable(true);
energyCost.resetColor();
} else {
btnCombine.enable(false);
energyCost.hardlight(0xFF0000);
}
} else {
btnCombine.enable(false);
output.visible = false;
energyCost.visible = false;
}
}
private void combine(){
ArrayList<Item> ingredients = filterInput(Item.class);
Recipe recipe = Recipe.findRecipe(ingredients);
Item result = null;
if (recipe != null){
provider.spendEnergy(recipe.cost(ingredients));
energyLeft.text(Messages.get(AlchemyScene.class, "energy", availableEnergy()));
energyLeft.setPos(
(Camera.main.width - energyLeft.width())/2,
Camera.main.height - 5 - energyLeft.height()
);
result = recipe.brew(ingredients);
}
if (result != null){
bubbleEmitter.start(Speck.factory( Speck.BUBBLE ), 0.01f, 100 );
smokeEmitter.burst(Speck.factory( Speck.WOOL ), 10 );
Sample.INSTANCE.play( Assets.SND_PUFF );
output.item(result);
if (!(result instanceof AlchemistsToolkit)) {
if (!result.collect()){
Dungeon.level.drop(result, Dungeon.hero.pos);
}
}
try {
Dungeon.saveAll();
} catch (IOException e) {
ShatteredPixelDungeon.reportException(e);
}
synchronized (inputs) {
for (int i = 0; i < inputs.length; i++) {
if (inputs[i] != null && inputs[i].item != null) {
if (inputs[i].item.quantity() <= 0 || inputs[i].item instanceof AlchemistsToolkit) {
inputs[i].slot.item(new WndBag.Placeholder(ItemSpriteSheet.SOMETHING));
inputs[i].item = null;
} else {
inputs[i].slot.item(inputs[i].item);
}
}
}
}
btnCombine.enable(false);
}
}
public void populate(ArrayList<Item> toFind, Belongings inventory){
clearSlots();
int curslot = 0;
for (Item finding : toFind){
int needed = finding.quantity();
ArrayList<Item> found = inventory.getAllSimilar(finding);
while (!found.isEmpty() && needed > 0){
Item detached;
if (finding instanceof Dart) {
detached = found.get(0).detachAll(inventory.backpack);
} else {
detached = found.get(0).detach(inventory.backpack);
}
inputs[curslot].item(detached);
curslot++;
needed -= detached.quantity();
if (detached == found.get(0)) {
found.remove(0);
}
}
}
updateState();
}
@Override
public void destroy() {
synchronized ( inputs ) {
clearSlots();
for (int i = 0; i < inputs.length; i++) {
inputs[i] = null;
}
}
try {
Dungeon.saveAll();
Badges.saveGlobal();
Journal.saveGlobal();
} catch (IOException e) {
ShatteredPixelDungeon.reportException(e);
}
super.destroy();
}
public void clearSlots(){
synchronized ( inputs ) {
for (int i = 0; i < inputs.length; i++) {
if (inputs[i] != null && inputs[i].item != null) {
if (!(inputs[i].item instanceof AlchemistsToolkit)) {
if (!inputs[i].item.collect()) {
Dungeon.level.drop(inputs[i].item, Dungeon.hero.pos);
}
}
inputs[i].item(null);
inputs[i].slot.item(new WndBag.Placeholder(ItemSpriteSheet.SOMETHING));
}
}
}
}
public static class ItemButton extends Component {
protected NinePatch bg;
protected ItemSlot slot;
public Item item = null;
@Override
protected void createChildren() {
super.createChildren();
bg = Chrome.get( Chrome.Type.RED_BUTTON);
add( bg );
slot = new ItemSlot() {
@Override
protected void onTouchDown() {
bg.brightness( 1.2f );
Sample.INSTANCE.play( Assets.SND_CLICK );
}
@Override
protected void onTouchUp() {
bg.resetColor();
}
@Override
protected void onClick() {
ItemButton.this.onClick();
}
};
slot.enable(true);
add( slot );
}
protected void onClick() {}
@Override
protected void layout() {
super.layout();
bg.x = x;
bg.y = y;
bg.size( width, height );
slot.setRect( x + 2, y + 2, width - 4, height - 4 );
}
public void item( Item item ) {
slot.item( this.item = item );
}
}
private static AlchemyProvider provider;
public static void setProvider( AlchemyProvider p ){
provider = p;
}
public static int availableEnergy(){
return provider == null ? 0 : provider.getEnergy();
}
public static boolean providerIsToolkit(){
return provider instanceof AlchemistsToolkit.kitEnergy;
}
public interface AlchemyProvider {
int getEnergy();
void spendEnergy(int reduction);
}
}
| 15,068 | AlchemyScene | java | en | java | code | {"qsc_code_num_words": 1676, "qsc_code_num_chars": 15068.0, "qsc_code_mean_word_length": 6.01610979, "qsc_code_frac_words_unique": 0.21002387, "qsc_code_frac_chars_top_2grams": 0.03481107, "qsc_code_frac_chars_top_3grams": 0.10175543, "qsc_code_frac_chars_top_4grams": 0.1134583, "qsc_code_frac_chars_dupe_5grams": 0.27690172, "qsc_code_frac_chars_dupe_6grams": 0.15997223, "qsc_code_frac_chars_dupe_7grams": 0.1070118, "qsc_code_frac_chars_dupe_8grams": 0.09352375, "qsc_code_frac_chars_dupe_9grams": 0.09134186, "qsc_code_frac_chars_dupe_10grams": 0.079639, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01555905, "qsc_code_frac_chars_whitespace": 0.19810194, "qsc_code_size_file_byte": 15068.0, "qsc_code_num_lines": 565.0, "qsc_code_num_chars_line_max": 132.0, "qsc_code_num_chars_line_mean": 26.66902655, "qsc_code_frac_chars_alphabet": 0.81891914, "qsc_code_frac_chars_comments": 0.05561455, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.25550661, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0021785, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.00477864, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.06828194, "qsc_codejava_score_lines_no_logic": 0.19162996, "qsc_codejava_frac_words_no_modifier": 0.90625, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 1 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/scenes/RankingsScene.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.scenes;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Rankings;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
import com.shatteredpixel.shatteredpixeldungeon.effects.Flare;
import com.shatteredpixel.shatteredpixeldungeon.input.GameAction;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.ui.Archs;
import com.shatteredpixel.shatteredpixeldungeon.ui.ExitButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndError;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndRanking;
import com.watabou.noosa.BitmapText;
import com.watabou.noosa.Camera;
import com.watabou.noosa.Image;
import com.watabou.noosa.audio.Music;
import com.watabou.noosa.ui.Button;
import com.watabou.utils.GameMath;
public class RankingsScene extends PixelScene {
private static final float ROW_HEIGHT_MAX = 20;
private static final float ROW_HEIGHT_MIN = 12;
private static final float MAX_ROW_WIDTH = 160;
private static final float GAP = 4;
private Archs archs;
@Override
public void create() {
super.create();
Music.INSTANCE.play( Assets.THEME, true );
uiCamera.visible = false;
int w = Camera.main.width;
int h = Camera.main.height;
archs = new Archs();
archs.setSize( w, h );
add( archs );
Rankings.INSTANCE.load();
RenderedTextBlock title = PixelScene.renderTextBlock( Messages.get(this, "title"), 9);
title.hardlight(Window.TITLE_COLOR);
title.setPos(
(w - title.width()) / 2f,
(20 - title.height()) / 2f
);
align(title);
add(title);
if (Rankings.INSTANCE.records.size() > 0) {
//attempts to give each record as much space as possible, ideally as much space as portrait mode
float rowHeight = GameMath.gate(ROW_HEIGHT_MIN, (uiCamera.height - 26)/Rankings.INSTANCE.records.size(), ROW_HEIGHT_MAX);
float left = (w - Math.min( MAX_ROW_WIDTH, w )) / 2 + GAP;
float top = (h - rowHeight * Rankings.INSTANCE.records.size()) / 2;
int pos = 0;
for (Rankings.Record rec : Rankings.INSTANCE.records) {
Record row = new Record( pos, pos == Rankings.INSTANCE.lastRecord, rec );
float offset =
rowHeight <= 14 ?
pos %2 == 1?
5 :
-5
: 0;
row.setRect( left+offset, top + pos * rowHeight, w - left * 2, rowHeight );
add(row);
pos++;
}
if (Rankings.INSTANCE.totalNumber >= Rankings.TABLE_SIZE) {
RenderedTextBlock label = PixelScene.renderTextBlock( 8 );
label.hardlight( 0xCCCCCC );
label.setHightlighting(true, Window.SHPX_COLOR);
label.text( Messages.get(this, "total") + " _" + Rankings.INSTANCE.wonNumber + "_/" + Rankings.INSTANCE.totalNumber );
add( label );
label.setPos(
(w - label.width()) / 2,
h - label.height() - 2*GAP
);
align(label);
}
} else {
RenderedTextBlock noRec = PixelScene.renderTextBlock(Messages.get(this, "no_games"), 8);
noRec.hardlight( 0xCCCCCC );
noRec.setPos(
(w - noRec.width()) / 2,
(h - noRec.height()) / 2
);
align(noRec);
add(noRec);
}
ExitButton btnExit = new ExitButton();
btnExit.setPos( Camera.main.width - btnExit.width(), 0 );
add( btnExit );
fadeIn();
}
@Override
protected void onBackPressed() {
ShatteredPixelDungeon.switchNoFade(TitleScene.class);
}
public static class Record extends Button<GameAction> {
private static final float GAP = 4;
private static final int[] TEXT_WIN = {0xFFFF88, 0xB2B25F};
private static final int[] TEXT_LOSE= {0xDDDDDD, 0x888888};
private static final int FLARE_WIN = 0x888866;
private static final int FLARE_LOSE = 0x666666;
private Rankings.Record rec;
protected ItemSprite shield;
private Flare flare;
private BitmapText position;
private RenderedTextBlock desc;
private Image steps;
private BitmapText depth;
private Image classIcon;
private BitmapText level;
public Record( int pos, boolean latest, Rankings.Record rec ) {
super();
this.rec = rec;
if (latest) {
flare = new Flare( 6, 24 );
flare.angularSpeed = 90;
flare.color( rec.win ? FLARE_WIN : FLARE_LOSE );
addToBack( flare );
}
if (pos != Rankings.TABLE_SIZE-1) {
position.text(Integer.toString(pos + 1));
} else
position.text(" ");
position.measure();
desc.text( Messages.titleCase(rec.desc()) );
//desc.measure();
int odd = pos % 2;
if (rec.win) {
shield.view( ItemSpriteSheet.AMULET, null );
position.hardlight( TEXT_WIN[odd] );
desc.hardlight( TEXT_WIN[odd] );
depth.hardlight( TEXT_WIN[odd] );
level.hardlight( TEXT_WIN[odd] );
} else {
position.hardlight( TEXT_LOSE[odd] );
desc.hardlight( TEXT_LOSE[odd] );
depth.hardlight( TEXT_LOSE[odd] );
level.hardlight( TEXT_LOSE[odd] );
if (rec.depth != 0){
depth.text( Integer.toString(rec.depth) );
depth.measure();
steps.copy(Icons.DEPTH.get());
add(steps);
add(depth);
}
}
if (rec.herolevel != 0){
level.text( Integer.toString(rec.herolevel) );
level.measure();
add(level);
}
classIcon.copy( Icons.get( rec.heroClass ) );
if (rec.heroClass == HeroClass.ROGUE){
//cloak of shadows needs to be brightened a bit
classIcon.brightness(2f);
}
}
@Override
protected void createChildren() {
super.createChildren();
shield = new ItemSprite( ItemSpriteSheet.TOMB, null );
add( shield );
position = new BitmapText( PixelScene.pixelFont);
add( position );
desc = renderTextBlock( 7 );
add( desc );
depth = new BitmapText( PixelScene.pixelFont);
steps = new Image();
classIcon = new Image();
add( classIcon );
level = new BitmapText( PixelScene.pixelFont);
}
@Override
protected void layout() {
super.layout();
shield.x = x;
shield.y = y + (height - shield.height) / 2f;
align(shield);
position.x = shield.x + (shield.width - position.width()) / 2f;
position.y = shield.y + (shield.height - position.height()) / 2f + 1;
align(position);
if (flare != null) {
flare.point( shield.center() );
}
classIcon.x = x + width - 16 + (16 - classIcon.width())/2f;
classIcon.y = shield.y + (16 - classIcon.height())/2f;
align(classIcon);
level.x = classIcon.x + (classIcon.width - level.width()) / 2f;
level.y = classIcon.y + (classIcon.height - level.height()) / 2f + 1;
align(level);
steps.x = x + width - 32 + (16 - steps.width())/2f;
steps.y = shield.y + (16 - steps.height())/2f;
align(steps);
depth.x = steps.x + (steps.width - depth.width()) / 2f;
depth.y = steps.y + (steps.height - depth.height()) / 2f + 1;
align(depth);
desc.maxWidth((int)(steps.x - (shield.x + shield.width + GAP)));
desc.setPos(shield.x + shield.width + GAP, shield.y + (shield.height - desc.height()) / 2f + 1);
align(desc);
}
@Override
protected void onClick() {
if (rec.gameData != null) {
parent.add( new WndRanking( rec ) );
} else {
parent.add( new WndError( Messages.get(RankingsScene.class, "no_info") ) );
}
}
}
}
| 8,417 | RankingsScene | java | en | java | code | {"qsc_code_num_words": 1019, "qsc_code_num_chars": 8417.0, "qsc_code_mean_word_length": 5.58390579, "qsc_code_frac_words_unique": 0.26005888, "qsc_code_frac_chars_top_2grams": 0.03479789, "qsc_code_frac_chars_top_3grams": 0.11353251, "qsc_code_frac_chars_top_4grams": 0.12372583, "qsc_code_frac_chars_dupe_5grams": 0.15553603, "qsc_code_frac_chars_dupe_6grams": 0.03304042, "qsc_code_frac_chars_dupe_7grams": 0.01195079, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01812021, "qsc_code_frac_chars_whitespace": 0.19353689, "qsc_code_size_file_byte": 8417.0, "qsc_code_num_lines": 300.0, "qsc_code_num_chars_line_max": 125.0, "qsc_code_num_chars_line_mean": 28.05666667, "qsc_code_frac_chars_alphabet": 0.82012375, "qsc_code_frac_chars_comments": 0.11179755, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.06220096, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00401284, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.00856073, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.02392344, "qsc_codejava_score_lines_no_logic": 0.17703349, "qsc_codejava_frac_words_no_modifier": 0.83333333, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 1 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/scenes/InterlevelScene.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.scenes;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.GamesInProgress;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Chasm;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.SpecialRoom;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.ui.GameLog;
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndError;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndStory;
import com.watabou.gltextures.TextureCache;
import com.watabou.glwrap.Blending;
import com.watabou.noosa.Camera;
import com.watabou.noosa.Game;
import com.watabou.noosa.Image;
import com.watabou.noosa.NoosaScript;
import com.watabou.noosa.NoosaScriptNoLighting;
import com.watabou.noosa.SkinnedBlock;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.DeviceCompat;
import java.io.FileNotFoundException;
import java.io.IOException;
public class InterlevelScene extends PixelScene {
//slow fade on entering a new region
private static final float SLOW_FADE = 1f; //.33 in, 1.33 steady, .33 out, 2 seconds total
//norm fade when loading, falling, returning, or descending to a new floor
private static final float NORM_FADE = 0.67f; //.33 in, .67 steady, .33 out, 1.33 seconds total
//fast fade when ascending, or descending to a floor you've been on
private static final float FAST_FADE = 0.50f; //.33 in, .33 steady, .33 out, 1 second total
private static float fadeTime;
public enum Mode {
DESCEND, ASCEND, CONTINUE, RESURRECT, RETURN, FALL, RESET, NONE
}
public static Mode mode;
public static int returnDepth;
public static int returnPos;
public static boolean noStory = false;
public static boolean fallIntoPit;
private enum Phase {
FADE_IN, STATIC, FADE_OUT
}
private Phase phase;
private float timeLeft;
private RenderedTextBlock message;
private static Thread thread;
private static Exception error = null;
private float waitingTime;
@Override
public void create() {
super.create();
String loadingAsset;
int loadingDepth;
final float scrollSpeed;
fadeTime = NORM_FADE;
switch (mode){
default:
loadingDepth = Dungeon.depth;
scrollSpeed = 0;
break;
case CONTINUE:
loadingDepth = GamesInProgress.check(GamesInProgress.curSlot).depth;
scrollSpeed = 5;
break;
case DESCEND:
if (Dungeon.hero == null){
loadingDepth = 1;
fadeTime = SLOW_FADE;
} else {
loadingDepth = Dungeon.depth+1;
if (!(Statistics.deepestFloor < loadingDepth)) {
fadeTime = FAST_FADE;
} else if (loadingDepth == 6 || loadingDepth == 11
|| loadingDepth == 16 || loadingDepth == 22) {
fadeTime = SLOW_FADE;
}
}
scrollSpeed = 5;
break;
case FALL:
loadingDepth = Dungeon.depth+1;
scrollSpeed = 50;
break;
case ASCEND:
fadeTime = FAST_FADE;
loadingDepth = Dungeon.depth-1;
scrollSpeed = -5;
break;
case RETURN:
loadingDepth = returnDepth;
scrollSpeed = returnDepth > Dungeon.depth ? 15 : -15;
break;
}
if (loadingDepth <= 5) loadingAsset = Assets.LOADING_SEWERS;
else if (loadingDepth <= 10) loadingAsset = Assets.LOADING_PRISON;
else if (loadingDepth <= 15) loadingAsset = Assets.LOADING_CAVES;
else if (loadingDepth <= 21) loadingAsset = Assets.LOADING_CITY;
else if (loadingDepth <= 25) loadingAsset = Assets.LOADING_HALLS;
else loadingAsset = Assets.SHADOW;
//speed up transition when debugging
if (DeviceCompat.isDebug()){
fadeTime /= 2;
}
SkinnedBlock bg = new SkinnedBlock(Camera.main.width, Camera.main.height, loadingAsset ){
@Override
protected NoosaScript script() {
return NoosaScriptNoLighting.get();
}
@Override
public void draw() {
Blending.disable();
super.draw();
Blending.enable();
}
@Override
public void update() {
super.update();
offset(0, Game.elapsed * scrollSpeed);
}
};
bg.scale(4, 4);
add(bg);
Image im = new Image(TextureCache.createGradient(0xAA000000, 0xBB000000, 0xCC000000, 0xDD000000, 0xFF000000)){
@Override
public void update() {
super.update();
if (phase == Phase.FADE_IN) aa = Math.max( 0, (timeLeft - (fadeTime - 0.333f)));
else if (phase == Phase.FADE_OUT) aa = Math.max( 0, (0.333f - timeLeft));
else aa = 0;
}
};
im.angle = 90;
im.x = Camera.main.width;
im.scale.x = Camera.main.height/5f;
im.scale.y = Camera.main.width;
add(im);
String text = Messages.get(Mode.class, mode.name());
message = PixelScene.renderTextBlock( text, 9 );
message.setPos(
(Camera.main.width - message.width()) / 2,
(Camera.main.height - message.height()) / 2
);
align(message);
add( message );
phase = Phase.FADE_IN;
timeLeft = fadeTime;
if (thread == null) {
thread = new Thread() {
@Override
public void run() {
try {
if (Dungeon.hero != null){
Dungeon.hero.spendToWhole();
}
Actor.fixTime();
switch (mode) {
case DESCEND:
descend();
break;
case ASCEND:
ascend();
break;
case CONTINUE:
restore();
break;
case RESURRECT:
resurrect();
break;
case RETURN:
returnTo();
break;
case FALL:
fall();
break;
case RESET:
reset();
break;
}
if ((Dungeon.depth % 5) == 0) {
Sample.INSTANCE.load(Assets.SND_BOSS);
}
} catch (Exception e) {
error = e;
}
if (phase == Phase.STATIC && error == null) {
phase = Phase.FADE_OUT;
timeLeft = fadeTime;
}
}
};
thread.start();
}
waitingTime = 0f;
}
@Override
public void update() {
super.update();
waitingTime += Game.elapsed;
float p = timeLeft / fadeTime;
switch (phase) {
case FADE_IN:
message.alpha( 1 - p );
if ((timeLeft -= Game.elapsed) <= 0) {
if (!thread.isAlive() && error == null) {
phase = Phase.FADE_OUT;
timeLeft = fadeTime;
} else {
phase = Phase.STATIC;
}
}
break;
case FADE_OUT:
message.alpha( p );
if ((timeLeft -= Game.elapsed) <= 0) {
Game.switchScene( GameScene.class );
thread = null;
error = null;
}
break;
case STATIC:
if (error != null) {
String errorMsg;
if (error instanceof FileNotFoundException) errorMsg = Messages.get(this, "file_not_found");
else if (error instanceof IOException) errorMsg = Messages.get(this, "io_error");
else if (error.getMessage() != null &&
error.getMessage().equals("old save")) errorMsg = Messages.get(this, "io_error");
else throw new RuntimeException("fatal error occured while moving between floors. " +
"Seed:" + Dungeon.seed + " depth:" + Dungeon.depth, error);
add( new WndError( errorMsg ) {
public void onBackPressed() {
super.onBackPressed();
Game.switchScene( StartScene.class );
}
} );
thread = null;
error = null;
} else if (thread != null && (int)waitingTime == 10){
waitingTime = 11f;
String s = "";
for (StackTraceElement t : thread.getStackTrace()){
s += "\n";
s += t.toString();
}
ShatteredPixelDungeon.reportException(
new RuntimeException("waited more than 10 seconds on levelgen. " +
"Seed:" + Dungeon.seed + " depth:" + Dungeon.depth + " trace:" +
s)
);
}
break;
}
}
private void descend() throws IOException {
if (Dungeon.hero == null) {
Mob.clearHeldAllies();
Dungeon.init();
if (noStory) {
Dungeon.chapters.add( WndStory.ID_SEWERS );
noStory = false;
}
GameLog.wipe();
} else {
Mob.holdAllies( Dungeon.level );
Dungeon.saveAll();
}
Level level;
if (Dungeon.depth >= Statistics.deepestFloor) {
level = Dungeon.newLevel();
} else {
Dungeon.depth++;
level = Dungeon.loadLevel( GamesInProgress.curSlot );
}
Dungeon.switchLevel( level, level.entrance );
}
private void fall() throws IOException {
Mob.holdAllies( Dungeon.level );
Buff.affect( Dungeon.hero, Chasm.Falling.class );
Dungeon.saveAll();
Level level;
if (Dungeon.depth >= Statistics.deepestFloor) {
level = Dungeon.newLevel();
} else {
Dungeon.depth++;
level = Dungeon.loadLevel( GamesInProgress.curSlot );
}
Dungeon.switchLevel( level, level.fallCell( fallIntoPit ));
}
private void ascend() throws IOException {
Mob.holdAllies( Dungeon.level );
Dungeon.saveAll();
Dungeon.depth--;
Level level = Dungeon.loadLevel( GamesInProgress.curSlot );
Dungeon.switchLevel( level, level.exit );
}
private void returnTo() throws IOException {
Mob.holdAllies( Dungeon.level );
Dungeon.saveAll();
Dungeon.depth = returnDepth;
Level level = Dungeon.loadLevel( GamesInProgress.curSlot );
Dungeon.switchLevel( level, returnPos );
}
private void restore() throws IOException {
Mob.clearHeldAllies();
GameLog.wipe();
Dungeon.loadGame( GamesInProgress.curSlot );
if (Dungeon.depth == -1) {
Dungeon.depth = Statistics.deepestFloor;
Dungeon.switchLevel( Dungeon.loadLevel( GamesInProgress.curSlot ), -1 );
} else {
Level level = Dungeon.loadLevel( GamesInProgress.curSlot );
Dungeon.switchLevel( level, Dungeon.hero.pos );
}
}
private void resurrect() throws IOException {
Mob.holdAllies( Dungeon.level );
if (Dungeon.level.locked) {
Dungeon.hero.resurrect( Dungeon.depth );
Dungeon.depth--;
Level level = Dungeon.newLevel();
Dungeon.switchLevel( level, level.entrance );
} else {
Dungeon.hero.resurrect( -1 );
Dungeon.resetLevel();
}
}
private void reset() throws IOException {
Mob.holdAllies( Dungeon.level );
SpecialRoom.resetPitRoom(Dungeon.depth+1);
Dungeon.depth--;
Level level = Dungeon.newLevel();
Dungeon.switchLevel( level, level.entrance );
}
@Override
protected void onBackPressed() {
//Do nothing
}
}
| 11,525 | InterlevelScene | java | en | java | code | {"qsc_code_num_words": 1265, "qsc_code_num_chars": 11525.0, "qsc_code_mean_word_length": 6.056917, "qsc_code_frac_words_unique": 0.26956522, "qsc_code_frac_chars_top_2grams": 0.03054033, "qsc_code_frac_chars_top_3grams": 0.08431219, "qsc_code_frac_chars_top_4grams": 0.09188202, "qsc_code_frac_chars_dupe_5grams": 0.27329679, "qsc_code_frac_chars_dupe_6grams": 0.18376403, "qsc_code_frac_chars_dupe_7grams": 0.12868703, "qsc_code_frac_chars_dupe_8grams": 0.11981206, "qsc_code_frac_chars_dupe_9grams": 0.10884886, "qsc_code_frac_chars_dupe_10grams": 0.08039676, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01667222, "qsc_code_frac_chars_whitespace": 0.21934924, "qsc_code_size_file_byte": 11525.0, "qsc_code_num_lines": 429.0, "qsc_code_num_chars_line_max": 113.0, "qsc_code_num_chars_line_mean": 26.86480186, "qsc_code_frac_chars_alphabet": 0.83494498, "qsc_code_frac_chars_comments": 0.09952278, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.32544379, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.01551359, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.00481788, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.05029586, "qsc_codejava_score_lines_no_logic": 0.18343195, "qsc_codejava_frac_words_no_modifier": 0.88888889, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 1 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/journal/Journal.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.journal;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.watabou.utils.Bundle;
import com.watabou.utils.FileUtils;
import java.io.IOException;
public class Journal {
public static final String JOURNAL_FILE = "journal.dat";
private static boolean loaded = false;
public static void loadGlobal(){
if (loaded){
return;
}
Bundle bundle;
try {
bundle = FileUtils.bundleFromFile( JOURNAL_FILE );
} catch (IOException e){
bundle = new Bundle();
}
Catalog.restore( bundle );
Document.restore( bundle );
loaded = true;
}
//package-private
static boolean saveNeeded = false;
public static void saveGlobal(){
if (!saveNeeded){
return;
}
Bundle bundle = new Bundle();
Catalog.store(bundle);
Document.store(bundle);
try {
FileUtils.bundleToFile( JOURNAL_FILE, bundle );
saveNeeded = false;
} catch (IOException e) {
ShatteredPixelDungeon.reportException(e);
}
}
}
| 1,819 | Journal | java | en | java | code | {"qsc_code_num_words": 227, "qsc_code_num_chars": 1819.0, "qsc_code_mean_word_length": 5.71806167, "qsc_code_frac_words_unique": 0.51982379, "qsc_code_frac_chars_top_2grams": 0.02542373, "qsc_code_frac_chars_top_3grams": 0.03004622, "qsc_code_frac_chars_top_4grams": 0.04391371, "qsc_code_frac_chars_dupe_5grams": 0.06317411, "qsc_code_frac_chars_dupe_6grams": 0.0431433, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01165981, "qsc_code_frac_chars_whitespace": 0.19846069, "qsc_code_size_file_byte": 1819.0, "qsc_code_num_lines": 77.0, "qsc_code_num_chars_line_max": 72.0, "qsc_code_num_chars_line_mean": 23.62337662, "qsc_code_frac_chars_alphabet": 0.87860082, "qsc_code_frac_chars_comments": 0.43870258, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.15789474, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.01077375, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.05263158, "qsc_codejava_score_lines_no_logic": 0.26315789, "qsc_codejava_frac_words_no_modifier": 0.66666667, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 1 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/journal/Catalog.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.journal;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClothArmor;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.HuntressArmor;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.LeatherArmor;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.MageArmor;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.MailArmor;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.PlateArmor;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.RogueArmor;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.ScaleArmor;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.WarriorArmor;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.AlchemistsToolkit;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.ChaliceOfBlood;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.CloakOfShadows;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.EtherealChains;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.HornOfPlenty;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.MasterThievesArmband;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.SandalsOfNature;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TalismanOfForesight;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.UnstableSpellbook;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfExperience;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfFrost;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHaste;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfInvisibility;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLevitation;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLiquidFlame;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMindVision;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfParalyticGas;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfPurity;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfToxicGas;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfAccuracy;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfEnergy;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfEvasion;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfForce;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfFuror;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfHaste;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfMight;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfSharpshooting;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfTenacity;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfWealth;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfIdentify;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfLullaby;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicMapping;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMirrorImage;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRage;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRemoveCurse;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRetribution;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTerror;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTransmutation;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfBlastWave;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfCorrosion;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfCorruption;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfDisintegration;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfFireblast;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfFrost;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfLightning;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfLivingEarth;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfMagicMissile;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfPrismaticLight;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfRegrowth;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfTransfusion;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfWarding;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.AssassinsBlade;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.BattleAxe;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Crossbow;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Dagger;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Dirk;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Flail;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Gauntlet;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Glaive;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Gloves;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Greataxe;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Greatshield;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Greatsword;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.HandAxe;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Longsword;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Mace;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Quarterstaff;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.RoundShield;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.RunicBlade;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Sai;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Scimitar;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Shortsword;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Spear;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Sword;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.WarHammer;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Whip;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.WornShortsword;
import com.watabou.utils.Bundle;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.List;
public enum Catalog {
WEAPONS,
ARMOR,
WANDS,
RINGS,
ARTIFACTS,
POTIONS,
SCROLLS;
private LinkedHashMap<Class<? extends Item>, Boolean> seen = new LinkedHashMap<>();
public Collection<Class<? extends Item>> items(){
return seen.keySet();
}
public boolean allSeen(){
for (Class<?extends Item> item : items()){
if (!seen.get(item)){
return false;
}
}
return true;
}
static {
WEAPONS.seen.put( WornShortsword.class, false);
WEAPONS.seen.put( Gloves.class, false);
WEAPONS.seen.put( Dagger.class, false);
WEAPONS.seen.put( MagesStaff.class, false);
//WEAPONS.seen.put( Boomerang.class, false);
WEAPONS.seen.put( Shortsword.class, false);
WEAPONS.seen.put( HandAxe.class, false);
WEAPONS.seen.put( Spear.class, false);
WEAPONS.seen.put( Quarterstaff.class, false);
WEAPONS.seen.put( Dirk.class, false);
WEAPONS.seen.put( Sword.class, false);
WEAPONS.seen.put( Mace.class, false);
WEAPONS.seen.put( Scimitar.class, false);
WEAPONS.seen.put( RoundShield.class, false);
WEAPONS.seen.put( Sai.class, false);
WEAPONS.seen.put( Whip.class, false);
WEAPONS.seen.put( Longsword.class, false);
WEAPONS.seen.put( BattleAxe.class, false);
WEAPONS.seen.put( Flail.class, false);
WEAPONS.seen.put( RunicBlade.class, false);
WEAPONS.seen.put( AssassinsBlade.class, false);
WEAPONS.seen.put( Crossbow.class, false);
WEAPONS.seen.put( Greatsword.class, false);
WEAPONS.seen.put( WarHammer.class, false);
WEAPONS.seen.put( Glaive.class, false);
WEAPONS.seen.put( Greataxe.class, false);
WEAPONS.seen.put( Greatshield.class, false);
WEAPONS.seen.put( Gauntlet.class, false);
ARMOR.seen.put( ClothArmor.class, false);
ARMOR.seen.put( LeatherArmor.class, false);
ARMOR.seen.put( MailArmor.class, false);
ARMOR.seen.put( ScaleArmor.class, false);
ARMOR.seen.put( PlateArmor.class, false);
ARMOR.seen.put( WarriorArmor.class, false);
ARMOR.seen.put( MageArmor.class, false);
ARMOR.seen.put( RogueArmor.class, false);
ARMOR.seen.put( HuntressArmor.class, false);
WANDS.seen.put( WandOfMagicMissile.class, false);
WANDS.seen.put( WandOfLightning.class, false);
WANDS.seen.put( WandOfDisintegration.class, false);
WANDS.seen.put( WandOfFireblast.class, false);
WANDS.seen.put( WandOfCorrosion.class, false);
WANDS.seen.put( WandOfBlastWave.class, false);
WANDS.seen.put( WandOfLivingEarth.class, false);
WANDS.seen.put( WandOfFrost.class, false);
WANDS.seen.put( WandOfPrismaticLight.class, false);
WANDS.seen.put( WandOfWarding.class, false);
WANDS.seen.put( WandOfTransfusion.class, false);
WANDS.seen.put( WandOfCorruption.class, false);
WANDS.seen.put( WandOfRegrowth.class, false);
RINGS.seen.put( RingOfAccuracy.class, false);
RINGS.seen.put( RingOfEnergy.class, false);
RINGS.seen.put( RingOfElements.class, false);
RINGS.seen.put( RingOfEvasion.class, false);
RINGS.seen.put( RingOfForce.class, false);
RINGS.seen.put( RingOfFuror.class, false);
RINGS.seen.put( RingOfHaste.class, false);
RINGS.seen.put( RingOfMight.class, false);
RINGS.seen.put( RingOfSharpshooting.class, false);
RINGS.seen.put( RingOfTenacity.class, false);
RINGS.seen.put( RingOfWealth.class, false);
ARTIFACTS.seen.put( AlchemistsToolkit.class, false);
//ARTIFACTS.seen.put( CapeOfThorns.class, false);
ARTIFACTS.seen.put( ChaliceOfBlood.class, false);
ARTIFACTS.seen.put( CloakOfShadows.class, false);
ARTIFACTS.seen.put( DriedRose.class, false);
ARTIFACTS.seen.put( EtherealChains.class, false);
ARTIFACTS.seen.put( HornOfPlenty.class, false);
//ARTIFACTS.seen.put( LloydsBeacon.class, false);
ARTIFACTS.seen.put( MasterThievesArmband.class, false);
ARTIFACTS.seen.put( SandalsOfNature.class, false);
ARTIFACTS.seen.put( TalismanOfForesight.class, false);
ARTIFACTS.seen.put( TimekeepersHourglass.class, false);
ARTIFACTS.seen.put( UnstableSpellbook.class, false);
POTIONS.seen.put( PotionOfHealing.class, false);
POTIONS.seen.put( PotionOfStrength.class, false);
POTIONS.seen.put( PotionOfLiquidFlame.class, false);
POTIONS.seen.put( PotionOfFrost.class, false);
POTIONS.seen.put( PotionOfToxicGas.class, false);
POTIONS.seen.put( PotionOfParalyticGas.class, false);
POTIONS.seen.put( PotionOfPurity.class, false);
POTIONS.seen.put( PotionOfLevitation.class, false);
POTIONS.seen.put( PotionOfMindVision.class, false);
POTIONS.seen.put( PotionOfInvisibility.class, false);
POTIONS.seen.put( PotionOfExperience.class, false);
POTIONS.seen.put( PotionOfHaste.class, false);
SCROLLS.seen.put( ScrollOfIdentify.class, false);
SCROLLS.seen.put( ScrollOfUpgrade.class, false);
SCROLLS.seen.put( ScrollOfRemoveCurse.class, false);
SCROLLS.seen.put( ScrollOfMagicMapping.class, false);
SCROLLS.seen.put( ScrollOfTeleportation.class, false);
SCROLLS.seen.put( ScrollOfRecharging.class, false);
SCROLLS.seen.put( ScrollOfMirrorImage.class, false);
SCROLLS.seen.put( ScrollOfTerror.class, false);
SCROLLS.seen.put( ScrollOfLullaby.class, false);
SCROLLS.seen.put( ScrollOfRage.class, false);
SCROLLS.seen.put( ScrollOfRetribution.class, false);
SCROLLS.seen.put( ScrollOfTransmutation.class, false);
}
public static LinkedHashMap<Catalog, Badges.Badge> catalogBadges = new LinkedHashMap<>();
static {
catalogBadges.put(WEAPONS, Badges.Badge.ALL_WEAPONS_IDENTIFIED);
catalogBadges.put(ARMOR, Badges.Badge.ALL_ARMOR_IDENTIFIED);
catalogBadges.put(WANDS, Badges.Badge.ALL_WANDS_IDENTIFIED);
catalogBadges.put(RINGS, Badges.Badge.ALL_RINGS_IDENTIFIED);
catalogBadges.put(ARTIFACTS, Badges.Badge.ALL_ARTIFACTS_IDENTIFIED);
catalogBadges.put(POTIONS, Badges.Badge.ALL_POTIONS_IDENTIFIED);
catalogBadges.put(SCROLLS, Badges.Badge.ALL_SCROLLS_IDENTIFIED);
}
public static boolean isSeen(Class<? extends Item> itemClass){
for (Catalog cat : values()) {
if (cat.seen.containsKey(itemClass)) {
return cat.seen.get(itemClass);
}
}
return false;
}
public static void setSeen(Class<? extends Item> itemClass){
for (Catalog cat : values()) {
if (cat.seen.containsKey(itemClass) && !cat.seen.get(itemClass)) {
cat.seen.put(itemClass, true);
Journal.saveNeeded = true;
}
}
Badges.validateItemsIdentified();
}
private static final String CATALOGS = "catalogs";
public static void store( Bundle bundle ){
Badges.loadGlobal();
ArrayList<String> seen = new ArrayList<>();
//if we have identified all items of a set, we use the badge to keep track instead.
if (!Badges.isUnlocked(Badges.Badge.ALL_ITEMS_IDENTIFIED)) {
for (Catalog cat : values()) {
if (!Badges.isUnlocked(catalogBadges.get(cat))) {
for (Class<? extends Item> item : cat.items()) {
if (cat.seen.get(item)) seen.add(item.getSimpleName());
}
}
}
}
bundle.put( CATALOGS, seen.toArray(new String[0]) );
}
public static void restore( Bundle bundle ){
Badges.loadGlobal();
//logic for if we have all badges
if (Badges.isUnlocked(Badges.Badge.ALL_ITEMS_IDENTIFIED)){
for ( Catalog cat : values()){
for (Class<? extends Item> item : cat.items()){
cat.seen.put(item, true);
}
}
return;
}
//catalog-specific badge logic
for (Catalog cat : values()){
if (Badges.isUnlocked(catalogBadges.get(cat))){
for (Class<? extends Item> item : cat.items()){
cat.seen.put(item, true);
}
}
}
//general save/load
if (bundle.contains(CATALOGS)) {
List<String> seen = Arrays.asList(bundle.getStringArray(CATALOGS));
//TODO should adjust this to tie into the bundling system's class array
for (Catalog cat : values()) {
for (Class<? extends Item> item : cat.items()) {
if (seen.contains(item.getSimpleName())) {
cat.seen.put(item, true);
}
}
}
}
}
}
| 17,660 | Catalog | java | en | java | code | {"qsc_code_num_words": 1802, "qsc_code_num_chars": 17660.0, "qsc_code_mean_word_length": 7.26082131, "qsc_code_frac_words_unique": 0.14761376, "qsc_code_frac_chars_top_2grams": 0.05457047, "qsc_code_frac_chars_top_3grams": 0.28462244, "qsc_code_frac_chars_top_4grams": 0.32619994, "qsc_code_frac_chars_dupe_5grams": 0.64185264, "qsc_code_frac_chars_dupe_6grams": 0.45811678, "qsc_code_frac_chars_dupe_7grams": 0.16615714, "qsc_code_frac_chars_dupe_8grams": 0.04234179, "qsc_code_frac_chars_dupe_9grams": 0.04203607, "qsc_code_frac_chars_dupe_10grams": 0.04203607, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00120903, "qsc_code_frac_chars_whitespace": 0.15696489, "qsc_code_size_file_byte": 17660.0, "qsc_code_num_lines": 352.0, "qsc_code_num_chars_line_max": 91.0, "qsc_code_num_chars_line_mean": 50.17045455, "qsc_code_frac_chars_alphabet": 0.87761956, "qsc_code_frac_chars_comments": 0.06795017, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.06506849, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00048603, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.00284091, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.01712329, "qsc_codejava_score_lines_no_logic": 0.38356164, "qsc_codejava_frac_words_no_modifier": 1.0, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": null, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/journal/Notes.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.journal;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.Key;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.watabou.utils.Bundlable;
import com.watabou.utils.Bundle;
import java.util.ArrayList;
import java.util.Collections;
public class Notes {
public static abstract class Record implements Comparable<Record>, Bundlable {
protected int depth;
public int depth(){
return depth;
}
public abstract String desc();
@Override
public abstract boolean equals(Object obj);
@Override
public int compareTo( Record another ) {
return another.depth() - depth();
}
private static final String DEPTH = "depth";
@Override
public void restoreFromBundle( Bundle bundle ) {
depth = bundle.getInt( DEPTH );
}
@Override
public void storeInBundle( Bundle bundle ) {
bundle.put( DEPTH, depth );
}
}
public enum Landmark {
WELL_OF_HEALTH,
WELL_OF_AWARENESS,
WELL_OF_TRANSMUTATION,
ALCHEMY,
GARDEN,
STATUE,
GHOST,
WANDMAKER,
TROLL,
IMP;
public String desc() {
return Messages.get(this, name());
}
}
public static class LandmarkRecord extends Record {
protected Landmark landmark;
public LandmarkRecord() {}
public LandmarkRecord(Landmark landmark, int depth ) {
this.landmark = landmark;
this.depth = depth;
}
@Override
public String desc() {
return landmark.desc();
}
@Override
public boolean equals(Object obj) {
return (obj instanceof LandmarkRecord)
&& landmark == ((LandmarkRecord) obj).landmark
&& depth() == ((LandmarkRecord) obj).depth();
}
private static final String LANDMARK = "landmark";
@Override
public void restoreFromBundle(Bundle bundle) {
super.restoreFromBundle(bundle);
landmark = Landmark.valueOf(bundle.getString(LANDMARK));
}
@Override
public void storeInBundle(Bundle bundle) {
super.storeInBundle(bundle);
bundle.put( LANDMARK, landmark.toString() );
}
}
public static class KeyRecord extends Record {
protected Key key;
public KeyRecord() {}
public KeyRecord( Key key ){
this.key = key;
}
@Override
public int depth() {
return key.depth;
}
@Override
public String desc() {
return key.toString();
}
public Class<? extends Key> type(){
return key.getClass();
}
public int quantity(){
return key.quantity();
}
public void quantity(int num){
key.quantity(num);
}
@Override
public boolean equals(Object obj) {
return (obj instanceof KeyRecord)
&& key.isSimilar(((KeyRecord) obj).key);
}
private static final String KEY = "key";
@Override
public void restoreFromBundle(Bundle bundle) {
super.restoreFromBundle(bundle);
key = (Key) bundle.get(KEY);
}
@Override
public void storeInBundle(Bundle bundle) {
super.storeInBundle(bundle);
bundle.put( KEY, key );
}
}
private static ArrayList<Record> records;
public static void reset() {
records = new ArrayList<>();
}
private static final String RECORDS = "records";
public static void storeInBundle( Bundle bundle ) {
bundle.put( RECORDS, records );
}
public static void restoreFromBundle( Bundle bundle ) {
records = new ArrayList<>();
for (Bundlable rec : bundle.getCollection( RECORDS ) ) {
records.add( (Record) rec );
}
}
public static boolean add( Landmark landmark ) {
LandmarkRecord l = new LandmarkRecord( landmark, Dungeon.depth );
if (!records.contains(l)) {
boolean result = records.add(new LandmarkRecord(landmark, Dungeon.depth));
Collections.sort(records);
return result;
}
return false;
}
public static boolean remove( Landmark landmark ) {
return records.remove( new LandmarkRecord(landmark, Dungeon.depth) );
}
public static boolean add( Key key ){
KeyRecord k = new KeyRecord(key);
if (!records.contains(k)){
boolean result = records.add(k);
Collections.sort(records);
return result;
} else {
k = (KeyRecord) records.get(records.indexOf(k));
k.quantity(k.quantity() + key.quantity());
return true;
}
}
public static boolean remove( Key key ){
KeyRecord k = new KeyRecord( key );
if (records.contains(k)){
k = (KeyRecord) records.get(records.indexOf(k));
k.quantity(k.quantity() - key.quantity());
if (k.quantity() <= 0){
records.remove(k);
}
return true;
}
return false;
}
public static int keyCount( Key key ){
KeyRecord k = new KeyRecord( key );
if (records.contains(k)){
k = (KeyRecord) records.get(records.indexOf(k));
return k.quantity();
} else {
return 0;
}
}
public static ArrayList<Record> getRecords(){
return getRecords(Record.class);
}
public static <T extends Record> ArrayList<T> getRecords( Class<T> recordType ){
ArrayList<T> filtered = new ArrayList<>();
for (Record rec : records){
if (recordType.isInstance(rec)){
filtered.add((T)rec);
}
}
return filtered;
}
public static void remove( Record rec ){
records.remove(rec);
}
}
| 5,947 | Notes | java | en | java | code | {"qsc_code_num_words": 691, "qsc_code_num_chars": 5947.0, "qsc_code_mean_word_length": 5.87988423, "qsc_code_frac_words_unique": 0.25180897, "qsc_code_frac_chars_top_2grams": 0.04134876, "qsc_code_frac_chars_top_3grams": 0.02658134, "qsc_code_frac_chars_top_4grams": 0.02362786, "qsc_code_frac_chars_dupe_5grams": 0.32094511, "qsc_code_frac_chars_dupe_6grams": 0.2424317, "qsc_code_frac_chars_dupe_7grams": 0.17770121, "qsc_code_frac_chars_dupe_8grams": 0.17770121, "qsc_code_frac_chars_dupe_9grams": 0.17770121, "qsc_code_frac_chars_dupe_10grams": 0.11370908, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00402713, "qsc_code_frac_chars_whitespace": 0.20665882, "qsc_code_size_file_byte": 5947.0, "qsc_code_num_lines": 262.0, "qsc_code_num_chars_line_max": 82.0, "qsc_code_num_chars_line_mean": 22.69847328, "qsc_code_frac_chars_alphabet": 0.85714286, "qsc_code_frac_chars_comments": 0.13132672, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.26315789, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00445219, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.13684211, "qsc_codejava_score_lines_no_logic": 0.24736842, "qsc_codejava_frac_words_no_modifier": 0.92592593, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 1 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/journal/Document.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.journal;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.utils.Bundle;
import com.watabou.utils.DeviceCompat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.List;
public enum Document {
ADVENTURERS_GUIDE(ItemSpriteSheet.GUIDE_PAGE),
ALCHEMY_GUIDE(ItemSpriteSheet.ALCH_PAGE);
Document( int sprite ){
pageSprite = sprite;
}
private LinkedHashMap<String, Boolean> pages = new LinkedHashMap<>();
public Collection<String> pages(){
return pages.keySet();
}
public boolean addPage( String page ) {
if (pages.containsKey(page) && !pages.get(page)){
pages.put(page, true);
Journal.saveNeeded = true;
return true;
}
return false;
}
public boolean hasPage( String page ){
return pages.containsKey(page) && pages.get(page);
}
public boolean hasPage( int pageIdx ){
return hasPage( pages.keySet().toArray(new String[0])[pageIdx] );
}
public boolean hasAnyPages(){
for (String p : pages.keySet()){
if (pages.get(p)) {
return true;
}
}
return false;
}
private int pageSprite;
public int pageSprite(){
return pageSprite;
}
public String title(){
return Messages.get( this, name() + ".title");
}
public String pageTitle( String page ){
return Messages.get( this, name() + "." + page + ".title");
}
public String pageTitle( int pageIdx ){
return pageTitle( pages.keySet().toArray(new String[0])[pageIdx] );
}
public String pageBody( String page ){
return Messages.get( this, name() + "." + page + ".body");
}
public String pageBody( int pageIdx ){
return pageBody( pages.keySet().toArray(new String[0])[pageIdx] );
}
public static final String GUIDE_INTRO_PAGE = "Intro";
public static final String GUIDE_SEARCH_PAGE = "Examining_and_Searching";
static {
ADVENTURERS_GUIDE.pages.put(GUIDE_INTRO_PAGE, DeviceCompat.isDebug());
ADVENTURERS_GUIDE.pages.put("Identifying", DeviceCompat.isDebug());
ADVENTURERS_GUIDE.pages.put(GUIDE_SEARCH_PAGE, DeviceCompat.isDebug());
ADVENTURERS_GUIDE.pages.put("Strength", DeviceCompat.isDebug());
ADVENTURERS_GUIDE.pages.put("Food", DeviceCompat.isDebug());
ADVENTURERS_GUIDE.pages.put("Levelling", DeviceCompat.isDebug());
ADVENTURERS_GUIDE.pages.put("Surprise_Attacks", DeviceCompat.isDebug());
ADVENTURERS_GUIDE.pages.put("Dieing", DeviceCompat.isDebug());
ADVENTURERS_GUIDE.pages.put("Looting", DeviceCompat.isDebug());
ADVENTURERS_GUIDE.pages.put("Magic", DeviceCompat.isDebug());
//sewers
ALCHEMY_GUIDE.pages.put("Potions", DeviceCompat.isDebug());
ALCHEMY_GUIDE.pages.put("Stones", DeviceCompat.isDebug());
ALCHEMY_GUIDE.pages.put("Energy_Food", DeviceCompat.isDebug());
ALCHEMY_GUIDE.pages.put("Bombs", DeviceCompat.isDebug());
//ALCHEMY_GUIDE.pages.put("Darts", DeviceCompat.isDebug());
//prison
ALCHEMY_GUIDE.pages.put("Exotic_Potions", DeviceCompat.isDebug());
ALCHEMY_GUIDE.pages.put("Exotic_Scrolls", DeviceCompat.isDebug());
//caves
ALCHEMY_GUIDE.pages.put("Catalysts", DeviceCompat.isDebug());
ALCHEMY_GUIDE.pages.put("Brews_Elixirs", DeviceCompat.isDebug());
ALCHEMY_GUIDE.pages.put("Spells", DeviceCompat.isDebug());
}
private static final String DOCUMENTS = "documents";
public static void store( Bundle bundle ){
Bundle docBundle = new Bundle();
for ( Document doc : values()){
ArrayList<String> pages = new ArrayList<>();
for (String page : doc.pages()){
if (doc.pages.get(page)){
pages.add(page);
}
}
if (!pages.isEmpty()) {
docBundle.put(doc.name(), pages.toArray(new String[0]));
}
}
bundle.put( DOCUMENTS, docBundle );
}
public static void restore( Bundle bundle ){
if (!bundle.contains( DOCUMENTS )){
return;
}
Bundle docBundle = bundle.getBundle( DOCUMENTS );
for ( Document doc : values()){
if (docBundle.contains(doc.name())){
List<String> pages = Arrays.asList(docBundle.getStringArray(doc.name()));
for (String page : pages){
if (doc.pages.containsKey(page)) {
doc.pages.put(page, true);
}
//pre-0.7.2 saves
else if (page.equals("Brews")){
doc.pages.put("Catalysts", true);
doc.pages.put("Brews_Elixirs", true);
}
}
}
}
}
}
| 5,349 | Document | java | en | java | code | {"qsc_code_num_words": 628, "qsc_code_num_chars": 5349.0, "qsc_code_mean_word_length": 5.80414013, "qsc_code_frac_words_unique": 0.28980892, "qsc_code_frac_chars_top_2grams": 0.0526749, "qsc_code_frac_chars_top_3grams": 0.07133059, "qsc_code_frac_chars_top_4grams": 0.06584362, "qsc_code_frac_chars_dupe_5grams": 0.32098765, "qsc_code_frac_chars_dupe_6grams": 0.27517147, "qsc_code_frac_chars_dupe_7grams": 0.10617284, "qsc_code_frac_chars_dupe_8grams": 0.05514403, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00547445, "qsc_code_frac_chars_whitespace": 0.18040755, "qsc_code_size_file_byte": 5349.0, "qsc_code_num_lines": 180.0, "qsc_code_num_chars_line_max": 78.0, "qsc_code_num_chars_line_mean": 29.71666667, "qsc_code_frac_chars_alphabet": 0.82595803, "qsc_code_frac_chars_comments": 0.16694709, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.04958678, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.05251346, "qsc_code_frac_chars_long_word_length": 0.00516158, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.12396694, "qsc_codejava_score_lines_no_logic": 0.25619835, "qsc_codejava_frac_words_no_modifier": 0.8, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": null, "qsc_codejava_frac_lines_print": 0.0} | 1 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/ui/changelist/ChangeButton.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.ui.changelist;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.watabou.noosa.Image;
import com.watabou.noosa.ui.Component;
//not actually a button, but functions as one.
public class ChangeButton extends Component {
protected Image icon;
protected String title;
protected String message;
public ChangeButton( Image icon, String title, String message){
super();
this.icon = icon;
add(this.icon);
this.title = Messages.titleCase(title);
this.message = message;
layout();
}
public ChangeButton(Item item, String message ){
this( new ItemSprite(item), item.name(), message);
}
protected void onClick() {
ShatteredPixelDungeon.scene().add(new ChangesWindow(new Image(icon), title, message));
}
@Override
protected void layout() {
super.layout();
icon.x = x + (width - icon.width) / 2f;
icon.y = y + (height - icon.height) / 2f;
PixelScene.align(icon);
}
}
| 2,038 | ChangeButton | java | en | java | code | {"qsc_code_num_words": 262, "qsc_code_num_chars": 2038.0, "qsc_code_mean_word_length": 5.82061069, "qsc_code_frac_words_unique": 0.47709924, "qsc_code_frac_chars_top_2grams": 0.04131148, "qsc_code_frac_chars_top_3grams": 0.1495082, "qsc_code_frac_chars_top_4grams": 0.1442623, "qsc_code_frac_chars_dupe_5grams": 0.05377049, "qsc_code_frac_chars_dupe_6grams": 0.03672131, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01109165, "qsc_code_frac_chars_whitespace": 0.15947007, "qsc_code_size_file_byte": 2038.0, "qsc_code_num_lines": 67.0, "qsc_code_num_chars_line_max": 89.0, "qsc_code_num_chars_line_mean": 30.41791045, "qsc_code_frac_chars_alphabet": 0.87915937, "qsc_code_frac_chars_comments": 0.40529931, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.0, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.05882353, "qsc_codejava_score_lines_no_logic": 0.38235294, "qsc_codejava_frac_words_no_modifier": 0.66666667, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 1 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/spells/WildEnergy.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.spells;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.ArtifactRecharge;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Recharging;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact;
import com.shatteredpixel.shatteredpixeldungeon.items.quest.MetalShard;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ScrollOfMysticalEnergy;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.CursedWand;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.utils.Callback;
public class WildEnergy extends TargetedSpell {
{
image = ItemSpriteSheet.WILD_ENERGY;
}
//we rely on cursedWand to do fx instead
@Override
protected void fx(Ballistica bolt, Callback callback) {
affectTarget(bolt, curUser);
}
@Override
protected void affectTarget(Ballistica bolt, final Hero hero) {
CursedWand.cursedZap(this, hero, bolt, new Callback() {
@Override
public void call() {
ScrollOfRecharging.charge(hero);
hero.belongings.charge(1f);
for (int i = 0; i < 4; i++){
if (hero.belongings.misc1 instanceof Artifact) ((Artifact) hero.belongings.misc1).charge(hero);
if (hero.belongings.misc2 instanceof Artifact) ((Artifact) hero.belongings.misc2).charge(hero);
}
Buff.affect(hero, Recharging.class, 8f);
Buff.affect(hero, ArtifactRecharge.class).prolong( 8 );
detach( curUser.belongings.backpack );
updateQuickslot();
curUser.spendAndNext( 1f );
}
});
}
@Override
public int price() {
//prices of ingredients, divided by output quantity
return Math.round(quantity * ((50 + 100) / 5f));
}
public static class Recipe extends com.shatteredpixel.shatteredpixeldungeon.items.Recipe.SimpleRecipe {
{
inputs = new Class[]{ScrollOfMysticalEnergy.class, MetalShard.class};
inQuantity = new int[]{1, 1};
cost = 8;
output = WildEnergy.class;
outQuantity = 5;
}
}
}
| 3,098 | WildEnergy | java | en | java | code | {"qsc_code_num_words": 363, "qsc_code_num_chars": 3098.0, "qsc_code_mean_word_length": 6.46831956, "qsc_code_frac_words_unique": 0.47107438, "qsc_code_frac_chars_top_2grams": 0.09412266, "qsc_code_frac_chars_top_3grams": 0.21039182, "qsc_code_frac_chars_top_4grams": 0.20613288, "qsc_code_frac_chars_dupe_5grams": 0.27086882, "qsc_code_frac_chars_dupe_6grams": 0.14182283, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01401515, "qsc_code_frac_chars_whitespace": 0.14783731, "qsc_code_size_file_byte": 3098.0, "qsc_code_num_lines": 91.0, "qsc_code_num_chars_line_max": 105.0, "qsc_code_num_chars_line_mean": 34.04395604, "qsc_code_frac_chars_alphabet": 0.87537879, "qsc_code_frac_chars_comments": 0.28114913, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.07407407, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.07407407, "qsc_codejava_score_lines_no_logic": 0.31481481, "qsc_codejava_frac_words_no_modifier": 0.8, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/SpiritBow.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.weapon;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.Splash;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfFuror;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfSharpshooting;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.CellSelector;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.sprites.MissileSprite;
import com.shatteredpixel.shatteredpixeldungeon.ui.QuickSlotButton;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Callback;
import com.watabou.utils.Random;
import java.util.ArrayList;
public class SpiritBow extends Weapon {
public static final String AC_SHOOT = "SHOOT";
{
image = ItemSpriteSheet.SPIRIT_BOW;
defaultAction = AC_SHOOT;
usesTargeting = true;
unique = true;
bones = false;
}
public boolean sniperSpecial = false;
@Override
public ArrayList<String> actions(Hero hero) {
ArrayList<String> actions = super.actions(hero);
actions.remove(AC_EQUIP);
actions.add(AC_SHOOT);
return actions;
}
@Override
public void execute(Hero hero, String action) {
super.execute(hero, action);
if (action.equals(AC_SHOOT)) {
curUser = hero;
curItem = this;
GameScene.selectCell( shooter );
}
}
@Override
public String info() {
String info = desc();
info += "\n\n" + Messages.get( SpiritBow.class, "stats",
Math.round(augment.damageFactor(min())),
Math.round(augment.damageFactor(max())),
STRReq());
if (STRReq() > Dungeon.hero.STR()) {
info += " " + Messages.get(Weapon.class, "too_heavy");
} else if (Dungeon.hero.STR() > STRReq()){
info += " " + Messages.get(Weapon.class, "excess_str", Dungeon.hero.STR() - STRReq());
}
switch (augment) {
case SPEED:
info += "\n\n" + Messages.get(Weapon.class, "faster");
break;
case DAMAGE:
info += "\n\n" + Messages.get(Weapon.class, "stronger");
break;
case NONE:
}
if (enchantment != null && (cursedKnown || !enchantment.curse())){
info += "\n\n" + Messages.get(Weapon.class, "enchanted", enchantment.name());
info += " " + Messages.get(enchantment, "desc");
}
if (cursed && isEquipped( Dungeon.hero )) {
info += "\n\n" + Messages.get(Weapon.class, "cursed_worn");
} else if (cursedKnown && cursed) {
info += "\n\n" + Messages.get(Weapon.class, "cursed");
} else if (!isIdentified() && cursedKnown){
info += "\n\n" + Messages.get(Weapon.class, "not_cursed");
}
info += "\n\n" + Messages.get(MissileWeapon.class, "distance");
return info;
}
@Override
public int STRReq(int lvl) {
lvl = Math.max(0, lvl);
//strength req decreases at +1,+3,+6,+10,etc.
return 10 - (int)(Math.sqrt(8 * lvl + 1) - 1)/2;
}
@Override
public int min(int lvl) {
return 1 + Dungeon.hero.lvl/5
+ RingOfSharpshooting.levelDamageBonus(Dungeon.hero)
+ (curseInfusionBonus ? 1 : 0);
}
@Override
public int max(int lvl) {
return 6 + (int)(Dungeon.hero.lvl/2.5f)
+ 2*RingOfSharpshooting.levelDamageBonus(Dungeon.hero)
+ (curseInfusionBonus ? 2 : 0);
}
private int targetPos;
@Override
public int damageRoll(Char owner) {
int damage = augment.damageFactor(super.damageRoll(owner));
if (owner instanceof Hero) {
int exStr = ((Hero)owner).STR() - STRReq();
if (exStr > 0) {
damage += Random.IntRange( 0, exStr );
}
}
if (sniperSpecial){
switch (augment){
case NONE:
damage = Math.round(damage * 0.667f);
break;
case SPEED:
damage = Math.round(damage * 0.5f);
break;
case DAMAGE:
int distance = Dungeon.level.distance(owner.pos, targetPos) - 1;
damage = Math.round(damage * (1f + 0.1f * distance));
break;
}
}
return damage;
}
@Override
public float speedFactor(Char owner) {
if (sniperSpecial){
switch (augment){
case NONE: default:
return 0f;
case SPEED:
return 1f * RingOfFuror.attackDelayMultiplier(owner);
case DAMAGE:
return 2f * RingOfFuror.attackDelayMultiplier(owner);
}
} else {
return super.speedFactor(owner);
}
}
@Override
public int level() {
//need to check if hero is null for loading an upgraded bow from pre-0.7.0
return (Dungeon.hero == null ? 0 : Dungeon.hero.lvl/5)
+ (curseInfusionBonus ? 1 : 0);
}
//for fetching upgrades from a boomerang from pre-0.7.1
public int spentUpgrades() {
return super.level() - (curseInfusionBonus ? 1 : 0);
}
@Override
public boolean isUpgradable() {
return false;
}
public SpiritArrow knockArrow(){
return new SpiritArrow();
}
public class SpiritArrow extends MissileWeapon {
{
image = ItemSpriteSheet.SPIRIT_ARROW;
}
@Override
public int damageRoll(Char owner) {
return SpiritBow.this.damageRoll(owner);
}
@Override
public boolean hasEnchant(Class<? extends Enchantment> type, Char owner) {
return SpiritBow.this.hasEnchant(type, owner);
}
@Override
public int proc(Char attacker, Char defender, int damage) {
return SpiritBow.this.proc(attacker, defender, damage);
}
@Override
public float speedFactor(Char user) {
return SpiritBow.this.speedFactor(user);
}
@Override
public float accuracyFactor(Char owner) {
if (sniperSpecial && SpiritBow.this.augment == Augment.DAMAGE){
return Float.POSITIVE_INFINITY;
} else {
return super.accuracyFactor(owner);
}
}
@Override
public int STRReq(int lvl) {
return SpiritBow.this.STRReq(lvl);
}
@Override
protected void onThrow( int cell ) {
Char enemy = Actor.findChar( cell );
if (enemy == null || enemy == curUser) {
parent = null;
Splash.at( cell, 0xCC99FFFF, 1 );
} else {
if (!curUser.shoot( enemy, this )) {
Splash.at(cell, 0xCC99FFFF, 1);
}
if (sniperSpecial && SpiritBow.this.augment != Augment.SPEED) sniperSpecial = false;
}
}
int flurryCount = -1;
@Override
public void cast(final Hero user, final int dst) {
final int cell = throwPos( user, dst );
SpiritBow.this.targetPos = cell;
if (sniperSpecial && SpiritBow.this.augment == Augment.SPEED){
if (flurryCount == -1) flurryCount = 3;
final Char enemy = Actor.findChar( cell );
if (enemy == null){
user.spendAndNext(castDelay(user, dst));
sniperSpecial = false;
flurryCount = -1;
return;
}
QuickSlotButton.target(enemy);
final boolean last = flurryCount == 1;
user.busy();
Sample.INSTANCE.play( Assets.SND_MISS, 0.6f, 0.6f, 1.5f );
((MissileSprite) user.sprite.parent.recycle(MissileSprite.class)).
reset(user.sprite,
cell,
this,
new Callback() {
@Override
public void call() {
if (enemy.isAlive()) {
curUser = user;
onThrow(cell);
}
if (last) {
user.spendAndNext(castDelay(user, dst));
sniperSpecial = false;
flurryCount = -1;
}
}
});
user.sprite.zap(cell, new Callback() {
@Override
public void call() {
flurryCount--;
if (flurryCount > 0){
cast(user, dst);
}
}
});
} else {
super.cast(user, dst);
}
}
}
private CellSelector.Listener shooter = new CellSelector.Listener() {
@Override
public void onSelect( Integer target ) {
if (target != null) {
knockArrow().cast(curUser, target);
}
}
@Override
public String prompt() {
return Messages.get(SpiritBow.class, "prompt");
}
};
}
| 8,972 | SpiritBow | java | en | java | code | {"qsc_code_num_words": 1019, "qsc_code_num_chars": 8972.0, "qsc_code_mean_word_length": 5.82924436, "qsc_code_frac_words_unique": 0.27281649, "qsc_code_frac_chars_top_2grams": 0.04949495, "qsc_code_frac_chars_top_3grams": 0.1023569, "qsc_code_frac_chars_top_4grams": 0.11111111, "qsc_code_frac_chars_dupe_5grams": 0.32340067, "qsc_code_frac_chars_dupe_6grams": 0.17760943, "qsc_code_frac_chars_dupe_7grams": 0.07946128, "qsc_code_frac_chars_dupe_8grams": 0.04478114, "qsc_code_frac_chars_dupe_9grams": 0.02087542, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01231423, "qsc_code_frac_chars_whitespace": 0.21255016, "qsc_code_size_file_byte": 8972.0, "qsc_code_num_lines": 342.0, "qsc_code_num_chars_line_max": 90.0, "qsc_code_num_chars_line_mean": 26.23391813, "qsc_code_frac_chars_alphabet": 0.82845011, "qsc_code_frac_chars_comments": 0.10633081, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.23664122, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.01646296, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.00249439, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.09160305, "qsc_codejava_score_lines_no_logic": 0.19847328, "qsc_codejava_frac_words_no_modifier": 0.88461538, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 1 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.weapon;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfFuror;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Annoying;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Displacing;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Exhausting;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Fragile;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Friendly;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Polarized;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Sacrificial;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Wayward;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Blazing;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Blocking;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Blooming;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Chilling;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Kinetic;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Corrupting;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Elastic;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Grim;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Lucky;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Projecting;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Shocking;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Unstable;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Vampiric;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.utils.Bundlable;
import com.watabou.utils.Bundle;
import com.watabou.utils.Random;
import com.watabou.utils.Reflection;
import java.util.ArrayList;
import java.util.Arrays;
abstract public class Weapon extends KindOfWeapon {
public float ACC = 1f; // Accuracy modifier
public float DLY = 1f; // Speed modifier
public int RCH = 1; // Reach modifier (only applies to melee hits)
public enum Augment {
SPEED (0.7f, 0.6667f),
DAMAGE (1.5f, 1.6667f),
NONE (1.0f, 1.0000f);
private float damageFactor;
private float delayFactor;
Augment(float dmg, float dly){
damageFactor = dmg;
delayFactor = dly;
}
public int damageFactor(int dmg){
return Math.round(dmg * damageFactor);
}
public float delayFactor(float dly){
return dly * delayFactor;
}
}
public Augment augment = Augment.NONE;
private static final int USES_TO_ID = 20;
private int usesLeftToID = USES_TO_ID;
private float availableUsesToID = USES_TO_ID/2f;
public Enchantment enchantment;
public boolean curseInfusionBonus = false;
@Override
public int proc( Char attacker, Char defender, int damage ) {
if (enchantment != null && attacker.buff(MagicImmune.class) == null) {
damage = enchantment.proc( this, attacker, defender, damage );
}
if (!levelKnown && attacker == Dungeon.hero && availableUsesToID >= 1) {
availableUsesToID--;
usesLeftToID--;
if (usesLeftToID <= 0) {
identify();
GLog.p( Messages.get(Weapon.class, "identify") );
Badges.validateItemLevelAquired( this );
}
}
return damage;
}
public void onHeroGainExp( float levelPercent, Hero hero ){
if (!levelKnown && isEquipped(hero) && availableUsesToID <= USES_TO_ID/2f) {
//gains enough uses to ID over 0.5 levels
availableUsesToID = Math.min(USES_TO_ID/2f, availableUsesToID + levelPercent * USES_TO_ID);
}
}
private static final String USES_LEFT_TO_ID = "uses_left_to_id";
private static final String AVAILABLE_USES = "available_uses";
private static final String ENCHANTMENT = "enchantment";
private static final String CURSE_INFUSION_BONUS = "curse_infusion_bonus";
private static final String AUGMENT = "augment";
@Override
public void storeInBundle( Bundle bundle ) {
super.storeInBundle( bundle );
bundle.put( USES_LEFT_TO_ID, usesLeftToID );
bundle.put( AVAILABLE_USES, availableUsesToID );
bundle.put( ENCHANTMENT, enchantment );
bundle.put( CURSE_INFUSION_BONUS, curseInfusionBonus );
bundle.put( AUGMENT, augment );
}
@Override
public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle( bundle );
usesLeftToID = bundle.getInt( USES_LEFT_TO_ID );
availableUsesToID = bundle.getInt( AVAILABLE_USES );
enchantment = (Enchantment)bundle.get( ENCHANTMENT );
curseInfusionBonus = bundle.getBoolean( CURSE_INFUSION_BONUS );
//pre-0.7.2 saves
if (bundle.contains( "unfamiliarity" )){
usesLeftToID = bundle.getInt( "unfamiliarity" );
availableUsesToID = USES_TO_ID/2f;
}
augment = bundle.getEnum(AUGMENT, Augment.class);
}
@Override
public void reset() {
super.reset();
usesLeftToID = USES_TO_ID;
availableUsesToID = USES_TO_ID/2f;
}
@Override
public float accuracyFactor( Char owner ) {
int encumbrance = 0;
if( owner instanceof Hero ){
encumbrance = STRReq() - ((Hero)owner).STR();
}
if (hasEnchant(Wayward.class, owner))
encumbrance = Math.max(2, encumbrance+2);
float ACC = this.ACC;
return encumbrance > 0 ? (float)(ACC / Math.pow( 1.5, encumbrance )) : ACC;
}
@Override
public float speedFactor( Char owner ) {
int encumbrance = 0;
if (owner instanceof Hero) {
encumbrance = STRReq() - ((Hero)owner).STR();
}
float DLY = augment.delayFactor(this.DLY);
DLY *= RingOfFuror.attackDelayMultiplier(owner);
return (encumbrance > 0 ? (float)(DLY * Math.pow( 1.2, encumbrance )) : DLY);
}
@Override
public int reachFactor(Char owner) {
return hasEnchant(Projecting.class, owner) ? RCH+1 : RCH;
}
public int STRReq(){
return STRReq(level());
}
public abstract int STRReq(int lvl);
@Override
public int level() {
return super.level() + (curseInfusionBonus ? 1 : 0);
}
@Override
public Item upgrade() {
return upgrade(false);
}
public Item upgrade(boolean enchant ) {
if (enchant){
if (enchantment == null || hasCurseEnchant()){
enchant(Enchantment.random());
}
} else {
if (hasCurseEnchant()){
if (Random.Int(3) == 0) enchant(null);
} else if (level() >= 4 && Random.Float(10) < Math.pow(2, level()-4)){
enchant(null);
}
}
cursed = false;
return super.upgrade();
}
@Override
public String name() {
return enchantment != null && (cursedKnown || !enchantment.curse()) ? enchantment.name( super.name() ) : super.name();
}
@Override
public Item random() {
//+0: 75% (3/4)
//+1: 20% (4/20)
//+2: 5% (1/20)
int n = 0;
if (Random.Int(4) == 0) {
n++;
if (Random.Int(5) == 0) {
n++;
}
}
level(n);
//30% chance to be cursed
//10% chance to be enchanted
float effectRoll = Random.Float();
if (effectRoll < 0.3f) {
enchant(Enchantment.randomCurse());
cursed = true;
} else if (effectRoll >= 0.9f){
enchant();
}
return this;
}
public Weapon enchant( Enchantment ench ) {
if (ench == null || !ench.curse()) curseInfusionBonus = false;
enchantment = ench;
updateQuickslot();
return this;
}
public Weapon enchant() {
Class<? extends Enchantment> oldEnchantment = enchantment != null ? enchantment.getClass() : null;
Enchantment ench = Enchantment.random( oldEnchantment );
return enchant( ench );
}
public boolean hasEnchant(Class<?extends Enchantment> type, Char owner) {
return enchantment != null && enchantment.getClass() == type && owner.buff(MagicImmune.class) == null;
}
//these are not used to process specific enchant effects, so magic immune doesn't affect them
public boolean hasGoodEnchant(){
return enchantment != null && !enchantment.curse();
}
public boolean hasCurseEnchant(){
return enchantment != null && enchantment.curse();
}
@Override
public ItemSprite.Glowing glowing() {
return enchantment != null && (cursedKnown || !enchantment.curse()) ? enchantment.glowing() : null;
}
public static abstract class Enchantment implements Bundlable {
private static final Class<?>[] common = new Class<?>[]{
Blazing.class, Chilling.class, Kinetic.class, Shocking.class};
private static final Class<?>[] uncommon = new Class<?>[]{
Blocking.class, Blooming.class, Elastic.class,
Lucky.class, Projecting.class, Unstable.class};
private static final Class<?>[] rare = new Class<?>[]{
Corrupting.class, Grim.class, Vampiric.class};
private static final float[] typeChances = new float[]{
50, //12.5% each
40, //6.67% each
10 //3.33% each
};
private static final Class<?>[] curses = new Class<?>[]{
Annoying.class, Displacing.class, Exhausting.class, Fragile.class,
Sacrificial.class, Wayward.class, Polarized.class, Friendly.class
};
public abstract int proc( Weapon weapon, Char attacker, Char defender, int damage );
public String name() {
if (!curse())
return name( Messages.get(this, "enchant"));
else
return name( Messages.get(Item.class, "curse"));
}
public String name( String weaponName ) {
return Messages.get(this, "name", weaponName);
}
public String desc() {
return Messages.get(this, "desc");
}
public boolean curse() {
return false;
}
@Override
public void restoreFromBundle( Bundle bundle ) {
}
@Override
public void storeInBundle( Bundle bundle ) {
}
public abstract ItemSprite.Glowing glowing();
@SuppressWarnings("unchecked")
public static Enchantment random( Class<? extends Enchantment> ... toIgnore ) {
switch(Random.chances(typeChances)){
case 0: default:
return randomCommon( toIgnore );
case 1:
return randomUncommon( toIgnore );
case 2:
return randomRare( toIgnore );
}
}
@SuppressWarnings("unchecked")
public static Enchantment randomCommon( Class<? extends Enchantment> ... toIgnore ) {
ArrayList<Class<?>> enchants = new ArrayList<>(Arrays.asList(common));
enchants.removeAll(Arrays.asList(toIgnore));
if (enchants.isEmpty()) {
return random();
} else {
return (Enchantment) Reflection.newInstance(Random.element(enchants));
}
}
@SuppressWarnings("unchecked")
public static Enchantment randomUncommon( Class<? extends Enchantment> ... toIgnore ) {
ArrayList<Class<?>> enchants = new ArrayList<>(Arrays.asList(uncommon));
enchants.removeAll(Arrays.asList(toIgnore));
if (enchants.isEmpty()) {
return random();
} else {
return (Enchantment) Reflection.newInstance(Random.element(enchants));
}
}
@SuppressWarnings("unchecked")
public static Enchantment randomRare( Class<? extends Enchantment> ... toIgnore ) {
ArrayList<Class<?>> enchants = new ArrayList<>(Arrays.asList(rare));
enchants.removeAll(Arrays.asList(toIgnore));
if (enchants.isEmpty()) {
return random();
} else {
return (Enchantment) Reflection.newInstance(Random.element(enchants));
}
}
@SuppressWarnings("unchecked")
public static Enchantment randomCurse( Class<? extends Enchantment> ... toIgnore ){
ArrayList<Class<?>> enchants = new ArrayList<>(Arrays.asList(curses));
enchants.removeAll(Arrays.asList(toIgnore));
if (enchants.isEmpty()) {
return random();
} else {
return (Enchantment) Reflection.newInstance(Random.element(enchants));
}
}
}
}
| 12,918 | Weapon | java | en | java | code | {"qsc_code_num_words": 1432, "qsc_code_num_chars": 12918.0, "qsc_code_mean_word_length": 6.49022346, "qsc_code_frac_words_unique": 0.21298883, "qsc_code_frac_chars_top_2grams": 0.0348612, "qsc_code_frac_chars_top_3grams": 0.13492576, "qsc_code_frac_chars_top_4grams": 0.15149559, "qsc_code_frac_chars_dupe_5grams": 0.40273295, "qsc_code_frac_chars_dupe_6grams": 0.31751668, "qsc_code_frac_chars_dupe_7grams": 0.2789972, "qsc_code_frac_chars_dupe_8grams": 0.12007747, "qsc_code_frac_chars_dupe_9grams": 0.12007747, "qsc_code_frac_chars_dupe_10grams": 0.12007747, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.0112401, "qsc_code_frac_chars_whitespace": 0.15977706, "qsc_code_size_file_byte": 12918.0, "qsc_code_num_lines": 416.0, "qsc_code_num_chars_line_max": 121.0, "qsc_code_num_chars_line_mean": 31.05288462, "qsc_code_frac_chars_alphabet": 0.84503409, "qsc_code_frac_chars_comments": 0.08910048, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.19230769, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.01410725, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.14423077, "qsc_codejava_score_lines_no_logic": 0.28846154, "qsc_codejava_frac_words_no_modifier": 0.71111111, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": null, "qsc_codejava_frac_lines_print": 0.0} | 1 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/keys/SkeletonKey.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.keys;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class SkeletonKey extends Key {
{
image = ItemSpriteSheet.SKELETON_KEY;
}
public SkeletonKey() {
this( 0 );
}
public SkeletonKey( int depth ) {
super();
this.depth = depth;
}
}
| 1,123 | SkeletonKey | java | en | java | code | {"qsc_code_num_words": 154, "qsc_code_num_chars": 1123.0, "qsc_code_mean_word_length": 5.35714286, "qsc_code_frac_words_unique": 0.62987013, "qsc_code_frac_chars_top_2grams": 0.04, "qsc_code_frac_chars_top_3grams": 0.04727273, "qsc_code_frac_chars_top_4grams": 0.06909091, "qsc_code_frac_chars_dupe_5grams": 0.09939394, "qsc_code_frac_chars_dupe_6grams": 0.06787879, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01978022, "qsc_code_frac_chars_whitespace": 0.18967053, "qsc_code_size_file_byte": 1123.0, "qsc_code_num_lines": 40.0, "qsc_code_num_chars_line_max": 73.0, "qsc_code_num_chars_line_mean": 28.075, "qsc_code_frac_chars_alphabet": 0.88681319, "qsc_code_frac_chars_comments": 0.69545859, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.0, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.0, "qsc_codejava_score_lines_no_logic": 0.14285714, "qsc_codejava_frac_words_no_modifier": 0.0, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": null, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/keys/GoldenKey.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.keys;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class GoldenKey extends Key {
{
image = ItemSpriteSheet.GOLDEN_KEY;
}
public GoldenKey() {
this( 0 );
}
public GoldenKey( int depth ) {
super();
this.depth = depth;
}
}
| 1,114 | GoldenKey | java | en | java | code | {"qsc_code_num_words": 154, "qsc_code_num_chars": 1114.0, "qsc_code_mean_word_length": 5.30519481, "qsc_code_frac_words_unique": 0.62987013, "qsc_code_frac_chars_top_2grams": 0.04039168, "qsc_code_frac_chars_top_3grams": 0.04773562, "qsc_code_frac_chars_top_4grams": 0.06976744, "qsc_code_frac_chars_dupe_5grams": 0.1003672, "qsc_code_frac_chars_dupe_6grams": 0.06854345, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01995565, "qsc_code_frac_chars_whitespace": 0.19030521, "qsc_code_size_file_byte": 1114.0, "qsc_code_num_lines": 40.0, "qsc_code_num_chars_line_max": 73.0, "qsc_code_num_chars_line_mean": 27.85, "qsc_code_frac_chars_alphabet": 0.88580931, "qsc_code_frac_chars_comments": 0.7010772, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.0, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.0, "qsc_codejava_score_lines_no_logic": 0.14285714, "qsc_codejava_frac_words_no_modifier": 0.0, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": null, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/keys/Key.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.keys;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.journal.Notes;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndJournal;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Bundle;
public abstract class Key extends Item {
public static final float TIME_TO_UNLOCK = 1f;
{
stackable = true;
unique = true;
}
public int depth;
@Override
public boolean isSimilar( Item item ) {
return super.isSimilar(item) && ((Key)item).depth == depth;
}
@Override
public boolean doPickUp(Hero hero) {
GameScene.pickUpJournal(this, hero.pos);
WndJournal.last_index = 2;
Notes.add(this);
Sample.INSTANCE.play( Assets.SND_ITEM );
hero.spendAndNext( TIME_TO_PICK_UP );
GameScene.updateKeyDisplay();
return true;
}
private static final String DEPTH = "depth";
@Override
public void storeInBundle( Bundle bundle ) {
super.storeInBundle( bundle );
bundle.put( DEPTH, depth );
}
@Override
public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle( bundle );
depth = bundle.getInt( DEPTH );
}
@Override
public boolean isUpgradable() {
return false;
}
@Override
public boolean isIdentified() {
return true;
}
}
| 2,286 | Key | java | en | java | code | {"qsc_code_num_words": 287, "qsc_code_num_chars": 2286.0, "qsc_code_mean_word_length": 5.96167247, "qsc_code_frac_words_unique": 0.5087108, "qsc_code_frac_chars_top_2grams": 0.04208065, "qsc_code_frac_chars_top_3grams": 0.15546464, "qsc_code_frac_chars_top_4grams": 0.15429573, "qsc_code_frac_chars_dupe_5grams": 0.08065459, "qsc_code_frac_chars_dupe_6grams": 0.0327294, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00990615, "qsc_code_frac_chars_whitespace": 0.16097988, "qsc_code_size_file_byte": 2286.0, "qsc_code_num_lines": 83.0, "qsc_code_num_chars_line_max": 72.0, "qsc_code_num_chars_line_mean": 27.54216867, "qsc_code_frac_chars_alphabet": 0.88216893, "qsc_code_frac_chars_comments": 0.34164479, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.16, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00332226, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.12, "qsc_codejava_score_lines_no_logic": 0.38, "qsc_codejava_frac_words_no_modifier": 0.85714286, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 1 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/keys/CrystalKey.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.keys;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class CrystalKey extends Key {
{
image = ItemSpriteSheet.CRYSTAL_KEY;
}
public CrystalKey() {
this( 0 );
}
public CrystalKey( int depth ) {
super();
this.depth = depth;
}
}
| 1,121 | CrystalKey | java | en | java | code | {"qsc_code_num_words": 154, "qsc_code_num_chars": 1121.0, "qsc_code_mean_word_length": 5.33116883, "qsc_code_frac_words_unique": 0.62987013, "qsc_code_frac_chars_top_2grams": 0.04019488, "qsc_code_frac_chars_top_3grams": 0.04750305, "qsc_code_frac_chars_top_4grams": 0.06942753, "qsc_code_frac_chars_dupe_5grams": 0.0998782, "qsc_code_frac_chars_dupe_6grams": 0.0682095, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01986755, "qsc_code_frac_chars_whitespace": 0.19179304, "qsc_code_size_file_byte": 1121.0, "qsc_code_num_lines": 41.0, "qsc_code_num_chars_line_max": 73.0, "qsc_code_num_chars_line_mean": 27.34146341, "qsc_code_frac_chars_alphabet": 0.88631347, "qsc_code_frac_chars_comments": 0.69669938, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.0, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.0, "qsc_codejava_score_lines_no_logic": 0.14285714, "qsc_codejava_frac_words_no_modifier": 0.0, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": null, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
00-Evan/shattered-pixel-dungeon-gdx | core/src/com/shatteredpixel/shatteredpixeldungeon/items/keys/IronKey.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2019 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.keys;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class IronKey extends Key {
{
image = ItemSpriteSheet.IRON_KEY;
}
public IronKey() {
this( 0 );
}
public IronKey( int depth ) {
super();
this.depth = depth;
}
}
| 1,106 | IronKey | java | en | java | code | {"qsc_code_num_words": 154, "qsc_code_num_chars": 1106.0, "qsc_code_mean_word_length": 5.25324675, "qsc_code_frac_words_unique": 0.62987013, "qsc_code_frac_chars_top_2grams": 0.0407911, "qsc_code_frac_chars_top_3grams": 0.04820766, "qsc_code_frac_chars_top_4grams": 0.07045735, "qsc_code_frac_chars_dupe_5grams": 0.1013597, "qsc_code_frac_chars_dupe_6grams": 0.06922126, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.02013423, "qsc_code_frac_chars_whitespace": 0.19168174, "qsc_code_size_file_byte": 1106.0, "qsc_code_num_lines": 40.0, "qsc_code_num_chars_line_max": 73.0, "qsc_code_num_chars_line_mean": 27.65, "qsc_code_frac_chars_alphabet": 0.88478747, "qsc_code_frac_chars_comments": 0.70614828, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.0, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 1.0, "qsc_codejava_frac_lines_func_ratio": 0.0, "qsc_codejava_score_lines_no_logic": 0.14285714, "qsc_codejava_frac_words_no_modifier": 0.0, "qsc_codejava_frac_words_legal_var_name": null, "qsc_codejava_frac_words_legal_func_name": null, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0} | 0 | {"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 1, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.